Skip to content

Commit b324bfd

Browse files
author
adil.rakhaliyev
committed
Fix: failing tests updated to new Node
1 parent b56d346 commit b324bfd

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎test/functional/fixtures/api/es-next/generic-errors/test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ describe('[API] Generic errors', function () {
9696
{ shouldFail: true, only: 'chrome' })
9797
.catch(function (errs) {
9898
expect(errs[0]).to.contains('> 8 | assert(false);');
99-
expect(errs[0]).to.match(/AssertionError( \[ERR_ASSERTION])?: false == true/);
99+
expect(errs[0]).to.match(/AssertionError( \[ERR_ASSERTION])?: (false == true|The expression evaluated to a falsy value)/);
100100
});
101101
});
102102
});

‎test/functional/fixtures/esm/test.js‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
const expect = require('chai').expect;
22
const config = require('../../config');
3-
const path = require('path');
3+
const path = require('path');
4+
const semver = require('semver');
45

56
describe('ESM support', function () {
67
if (config.esm) {
78
it('Should import ESM without errors in ESM mode', function () {
89
return runTests('./testcafe-fixtures/import-esm.js', null, { only: 'chrome' });
910
});
1011
}
12+
else if (semver.gte(process.version, '22.12.0')) {
13+
// Node.js 22.12.0+ supports require(esm) natively, so ESM imports succeed even in non-ESM mode
14+
it('Should import ESM without errors in CommonJS mode on Node.js 22.12.0+', function () {
15+
return runTests('./testcafe-fixtures/import-esm.js', null, { only: 'chrome' });
16+
});
17+
}
1118
else {
1219
it('Should throw an error if ESM imported in CommonJS mode', function () {
1320
return runTests('./testcafe-fixtures/import-esm.js', null, { shouldFail: true, only: 'chrome' })

0 commit comments

Comments
 (0)