Skip to content

Commit 210d0eb

Browse files
committed
test: shim assert.strict for node@8.3.0
1 parent 81c2d44 commit 210d0eb

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"node": ">=8"
2626
},
2727
"scripts": {
28-
"test": "mocha",
28+
"test": "mocha -r ./test/mocha-initialization.js",
2929
"benchmark": "node benchmark"
3030
},
3131
"dependencies": {

test/braces.parse.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('braces.parse()', () => {
1616
it('should return an AST', () => {
1717
const ast = parse('a/{b,c}/d');
1818
const brace = ast.nodes.find(node => node.type === 'brace');
19-
assert(brace);
19+
assert.ok(brace);
2020
assert.equal(brace.nodes.length, 5);
2121
});
2222

@@ -30,7 +30,7 @@ describe('braces.parse()', () => {
3030
const ast = parse('a/{a,b,[{c,d}]}/e');
3131
const brace = ast.nodes[2];
3232
const bracket = brace.nodes.find(node => node.value[0] === '[');
33-
assert(bracket);
33+
assert.ok(bracket);
3434
assert.equal(bracket.value, '[{c,d}]');
3535
});
3636
});

test/mocha-initialization.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @fileoverview
3+
* This package works with node@8.3.0 , which does not have support for `assert.strict`.
4+
* This module is a shim to support these methods.
5+
*
6+
* @todo Remove this file when we drop support for node@8.3.0.
7+
*/
8+
const assert = require('assert');
9+
10+
if (assert.strict === undefined) {
11+
assert.strict = {
12+
ok: assert.ok,
13+
equal: assert.equal,
14+
deepEqual: assert.deepEqual,
15+
throws: assert.throws,
16+
};
17+
}

0 commit comments

Comments
 (0)