summaryrefslogtreecommitdiff
path: root/test/parallel/test-process-assert.js
blob: 2f0c3fc9430ce06d418f79f26a5afa3a31c863fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use strict';
const common = require('../common');
const assert = require('assert');

common.expectWarning(
  'DeprecationWarning',
  'process.assert() is deprecated. Please use the `assert` module instead.',
  'DEP0100'
);

assert.strictEqual(process.assert(1, 'error'), undefined);
assert.throws(() => {
  process.assert(undefined, 'errorMessage');
}, {
  code: 'ERR_ASSERTION',
  name: 'Error',
  message: 'errorMessage'
});
assert.throws(() => {
  process.assert(false);
}, {
  code: 'ERR_ASSERTION',
  name: 'Error',
  message: 'assertion error'
});