From 7dc82dc2800b3d327262035536593c43c4fe4d50 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Thu, 18 Jan 2024 18:05:04 -0700 Subject: [PATCH] chore: update chai --- package.json | 2 +- pnpm-lock.yaml | 54 +++++++++++++++++----------------------- test-helpers/node-env.js | 17 +------------ test/test.callback.js | 11 +------- 4 files changed, 26 insertions(+), 58 deletions(-) diff --git a/package.json b/package.json index 94c6b32..eced99d 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 513eff4..0b4d0db 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -24,8 +24,8 @@ devDependencies: specifier: ^9.1.0 version: 9.1.0 chai: - specifier: ^4.4.1 - version: 4.4.1 + specifier: ^5.0.0 + version: 5.0.0 core-js-bundle: specifier: ^3.35.0 version: 3.35.0 @@ -2334,8 +2334,9 @@ packages: is-shared-array-buffer: 1.0.2 dev: true - /assertion-error@1.1.0: - resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} + /assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} dev: true /ast-metadata-inferer@0.8.0: @@ -2615,17 +2616,15 @@ packages: resolution: {integrity: sha512-+3e0ASu4sw1SWaoCtvPeyXp+5PsjigkSt8OXZbF9StH5pQWbxEjLAZE3n8Aup5udop1uRiKA7a4utUk/uoSpUw==} dev: true - /chai@4.4.1: - resolution: {integrity: sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==} - engines: {node: '>=4'} + /chai@5.0.0: + resolution: {integrity: sha512-HO5p0oEKd5M6HEcwOkNAThAE3j960vIZvVcc0t2tI06Dd0ATu69cEnMB2wOhC5/ZyQ6m67w3ePjU/HzXsSsdBA==} + engines: {node: '>=12'} dependencies: - assertion-error: 1.1.0 - check-error: 1.0.3 - deep-eql: 4.1.3 - get-func-name: 2.0.2 - loupe: 2.3.7 - pathval: 1.1.1 - type-detect: 4.0.8 + assertion-error: 2.0.1 + check-error: 2.0.0 + deep-eql: 5.0.1 + loupe: 3.1.0 + pathval: 2.0.0 dev: true /chalk-template@0.4.0: @@ -2669,10 +2668,9 @@ packages: resolution: {integrity: sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==} dev: true - /check-error@1.0.3: - resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} - dependencies: - get-func-name: 2.0.2 + /check-error@2.0.0: + resolution: {integrity: sha512-tjLAOBHKVxtPoHe/SA7kNOMvhCRdCJ3vETdeY0RuAc9popf+hyaSV6ZEg9hr4cpWF7jmo/JSWEnLDrnijS9Tog==} + engines: {node: '>= 16'} dev: true /chokidar@3.5.3: @@ -3004,11 +3002,9 @@ packages: mimic-response: 3.1.0 dev: true - /deep-eql@4.1.3: - resolution: {integrity: sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==} + /deep-eql@5.0.1: + resolution: {integrity: sha512-nwQCf6ne2gez3o1MxWifqkciwt0zhl0LO1/UwVu4uMBuPmflWM4oQ70XMqHqnBJA+nhzncaqL9HVL6KkHJ28lw==} engines: {node: '>=6'} - dependencies: - type-detect: 4.0.8 dev: true /deep-extend@0.6.0: @@ -4948,8 +4944,8 @@ packages: is-unicode-supported: 0.1.0 dev: true - /loupe@2.3.7: - resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} + /loupe@3.1.0: + resolution: {integrity: sha512-qKl+FrLXUhFuHUoDJG7f8P8gEMHq9NFS0c6ghXG1J0rldmZFQZoNVv/vyirE9qwCIhWZDsvEFd1sbFu3GvRQFg==} dependencies: get-func-name: 2.0.2 dev: true @@ -5734,8 +5730,9 @@ packages: engines: {node: '>=8'} dev: true - /pathval@1.1.1: - resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} + /pathval@2.0.0: + resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} + engines: {node: '>= 14.16'} dev: true /peek-readable@5.0.0: @@ -6673,11 +6670,6 @@ packages: prelude-ls: 1.2.1 dev: true - /type-detect@4.0.8: - resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} - engines: {node: '>=4'} - dev: true - /type-fest@0.20.2: resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} engines: {node: '>=10'} diff --git a/test-helpers/node-env.js b/test-helpers/node-env.js index 659e53c..e4798dc 100644 --- a/test-helpers/node-env.js +++ b/test-helpers/node-env.js @@ -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'); diff --git a/test/test.callback.js b/test/test.callback.js index ed26bcd..79d034d 100644 --- a/test/test.callback.js +++ b/test/test.callback.js @@ -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