Skip to content

Commit be24c49

Browse files
authored
test: only set no-experimental-require-module in node22 version and a… (#6837)
1 parent d77a6df commit be24c49

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

packages/toolkit/utils/src/cli/version.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ export function isVersionAtLeast18(): boolean {
99
const versionArr = nodeVersion.split('.').map(Number);
1010
return versionArr[0] >= 18;
1111
}
12+
13+
export function isVersionAtLeast22(): boolean {
14+
const nodeVersion = process.versions.node;
15+
const versionArr = nodeVersion.split('.').map(Number);
16+
return versionArr[0] >= 22;
17+
}

tests/integration/pure-esm-project/tests/index.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
modernServe,
1111
} from '../../../utils/modernTestUtils';
1212
import 'isomorphic-fetch';
13-
import { isVersionAtLeast1819 } from '@modern-js/utils';
13+
import { isVersionAtLeast22, isVersionAtLeast1819 } from '@modern-js/utils';
1414

1515
const appDir = path.resolve(__dirname, '../');
1616
dns.setDefaultResultOrder('ipv4first');
@@ -30,9 +30,11 @@ if (isVersionAtLeast1819()) {
3030
appDir,
3131
port,
3232
{},
33-
{
34-
NODE_OPTIONS: '--no-experimental-require-module',
35-
},
33+
isVersionAtLeast22()
34+
? {
35+
NODE_OPTIONS: '--no-experimental-require-module',
36+
}
37+
: {},
3638
);
3739
browser = await puppeteer.launch(launchOptions as any);
3840
page = await browser.newPage();

0 commit comments

Comments
 (0)