Skip to content

Commit

Permalink
chore: update chai
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Jan 19, 2024
1 parent 9d08b9a commit 7dc82dc
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 58 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-terser": "^0.4.4",
"c8": "^9.1.0",
"chai": "^4.4.1",
"chai": "^5.0.0",
"core-js-bundle": "^3.35.0",
"coveradge": "^0.8.2",
"eslint": "^8.56.0",
Expand Down
54 changes: 23 additions & 31 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 1 addition & 16 deletions test-helpers/node-env.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,13 @@
import {assert, expect} from 'chai';

// Test when Node VM is not supported
const toStr = Object.prototype.toString;
// eslint-disable-next-line no-extend-native
Object.prototype.toString = function () {
if (this === global.process) {
if (global.forceBuiltinVM) {
throw new Error('oops');
}
// Native is not doing this here now
return '[object process]';
}
return toStr.call(Object.prototype);
};

global.assert = assert;
global.expect = expect;

setTimeout(async () => {
global.forceBuiltinVM = false;
const {JSONPath} = await import('../src/jsonpath-node.js');
global.jsonpathNodeVM = JSONPath;
global.jsonpath = JSONPath;
global.forceBuiltinVM = true;

const {
JSONPath: JSONPathBrowser
} = await import('../src/jsonpath-browser.js');
Expand Down
11 changes: 1 addition & 10 deletions test/test.callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,7 @@ describe('JSONPath - Callback', function () {
}
jsonpath({json, path: '$.store.bicycle', resultType: 'all', wrap: false, callback});
assert.deepEqual(result[0], expected[0]);
// Todo[chai@>=5]: Error with circular perhaps will be resolved per https://github.com/chaijs/chai/issues/1109#issuecomment-395980733
// so can try directly comparing whole object (as commented out) rather
// than in parts as below that
// assert.deepEqual(result, expected);
Object.keys(result[1]).forEach((prop) => {
assert.deepEqual(result[1][prop], expected[1][prop]);
});
Object.keys(result[2]).forEach((prop) => {
assert.deepEqual(result[2][prop], expected[2][prop]);
});
assert.deepEqual(result, expected);
});

// https://github.com/s3u/JSONPath/issues/126
Expand Down

0 comments on commit 7dc82dc

Please sign in to comment.