Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Chai@4.4.0 syntax error in assertion.js:69 #1573

Closed
breandandalton opened this issue Jan 9, 2024 · 2 comments
Closed

Chai@4.4.0 syntax error in assertion.js:69 #1573

breandandalton opened this issue Jan 9, 2024 · 2 comments

Comments

@breandandalton
Copy link

Environment:
We are currently picking up chai@4.4.0 in our dependency "chai": "^4.1.1".
Resolved dependencies:
+-- chai@4.4.0
| +-- 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

Problem
First noticed this problem during a nightly build, at 2024-01-07T00:28:35.648Z (shortly after 4.4.0 was last published) and nightly thereafter:

[2024-01-07T00:28:35.648Z] /srv/mantle-cucumber/node_modules/chai/lib/chai/assertion.js:69
[2024-01-07T00:28:35.648Z] flag(this, 'eql', config.deepEqual ?? util.eql);
[2024-01-07T00:28:35.648Z] ^
[2024-01-07T00:28:35.648Z]
[2024-01-07T00:28:35.648Z] SyntaxError: Unexpected token ?
[2024-01-07T00:28:35.648Z] at createScript (vm.js:56:10)
[2024-01-07T00:28:35.648Z] at Object.runInThisContext (vm.js:97:10)
[2024-01-07T00:28:35.648Z] at Module._compile (module.js:549:28)
[2024-01-07T00:28:35.648Z] at Object.Module._extensions..js (module.js:586:10)
[2024-01-07T00:28:35.648Z] at Module.load (module.js:494:32)
[2024-01-07T00:28:35.648Z] at tryModuleLoad (module.js:453:12)
[2024-01-07T00:28:35.648Z] at Function.Module._load (module.js:445:3)
[2024-01-07T00:28:35.648Z] at Module.require (module.js:504:17)
[2024-01-07T00:28:35.648Z] at require (internal/module.js:20:19)
[2024-01-07T00:28:35.648Z] at Object. (/srv/mantle-cucumber/node_modules/chai/lib/chai.js:63:17)

Reverting to version 4.3.10 resolved the issue.

@43081j
Copy link
Contributor

43081j commented Jan 10, 2024

seems this is because a PR introduced ?? syntax which breaks node compatibility

what version of node do you use?

you can prove that's the case by using a newer node version temporarily and seeing if the error stops happening.

if that is the case, we may need to revert the syntax

43081j pushed a commit to 43081j/chai that referenced this issue Jan 10, 2024
We shipped syntax which is beyond our `engine` constraint. `??` is
available in node 14 but 4.x is node 4 and above, while 5.x is node 12
and above.

This just dumbs it back down to `||` for now at least.

Fixes chaijs#1573
43081j added a commit to 43081j/chai that referenced this issue Jan 10, 2024
We shipped syntax which is beyond our `engine` constraint. `??` is
available in node 14 but 4.x is node 4 and above, while 5.x is node 12
and above.

This just dumbs it back down to `||` for now at least.

Fixes chaijs#1573
keithamus pushed a commit that referenced this issue Jan 12, 2024
We shipped syntax which is beyond our `engine` constraint. `??` is
available in node 14 but 4.x is node 4 and above, while 5.x is node 12
and above.

This just dumbs it back down to `||` for now at least.

Fixes #1573
@koddsson
Copy link
Member

Fixed in 4.4.1.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants