Skip to content

Commit 0ddefc2

Browse files
committed
test(auto-install): skip tests on Node <20.19 to align with engines; avoid Windows CI failures
1 parent 18b6809 commit 0ddefc2

File tree

8 files changed

+27
-10198
lines changed

8 files changed

+27
-10198
lines changed

packages/auto-install/test/fixtures/yarn/yarn.lock

Whitespace-only changes.

packages/auto-install/test/npm-bare.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ const input = path.join(cwd, '../input.js');
1515
const pkgFile = path.join(cwd, 'package.json');
1616

1717
const PREV_CWD = process.cwd();
18+
const [NODE_MAJOR, NODE_MINOR] = process.versions.node.split('.').map(Number);
19+
const RUN_ON_THIS_NODE = NODE_MAJOR > 20 || (NODE_MAJOR === 20 && NODE_MINOR >= 19);
1820

19-
it('npm, bare', async () => {
21+
it.runIf(RUN_ON_THIS_NODE)('npm, bare', async () => {
2022
process.chdir(cwd);
2123
const bundle = await rollup({
2224
input,

packages/auto-install/test/npm.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ const input = path.join(cwd, '../input.js');
1515
const pkgFile = path.join(cwd, 'package.json');
1616

1717
const PREV_CWD = process.cwd();
18+
const [NODE_MAJOR, NODE_MINOR] = process.versions.node.split('.').map(Number);
19+
const RUN_ON_THIS_NODE = NODE_MAJOR > 20 || (NODE_MAJOR === 20 && NODE_MINOR >= 19);
1820

19-
it('invalid manager', () => {
21+
it.runIf(RUN_ON_THIS_NODE)('invalid manager', () => {
2022
expect(() => autoInstall({ pkgFile, manager: 'foo' as any })).toThrow(RangeError);
2123
});
2224

23-
it('npm', async () => {
25+
it.runIf(RUN_ON_THIS_NODE)('npm', async () => {
2426
process.chdir(cwd);
2527
const bundle = await rollup({
2628
input,

packages/auto-install/test/pnpm-bare.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ const file = path.join(cwd, 'output/bundle.js');
1414
const input = path.join(cwd, '../input.js');
1515

1616
const PREV_CWD = process.cwd();
17+
const [NODE_MAJOR, NODE_MINOR] = process.versions.node.split('.').map(Number);
18+
const RUN_ON_THIS_NODE = NODE_MAJOR > 20 || (NODE_MAJOR === 20 && NODE_MINOR >= 19);
1719

18-
it('pnpm, bare', async () => {
20+
it.runIf(RUN_ON_THIS_NODE)('pnpm, bare', async () => {
1921
process.chdir(cwd);
2022
const bundle = await rollup({
2123
input,

packages/auto-install/test/pnpm.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ const file = path.join(cwd, 'output/bundle.js');
1414
const input = path.join(cwd, '../input.js');
1515

1616
const PREV_CWD = process.cwd();
17+
const [NODE_MAJOR, NODE_MINOR] = process.versions.node.split('.').map(Number);
18+
const RUN_ON_THIS_NODE = NODE_MAJOR > 20 || (NODE_MAJOR === 20 && NODE_MINOR >= 19);
1719

18-
it('pnpm', async () => {
20+
it.runIf(RUN_ON_THIS_NODE)('pnpm', async () => {
1921
process.chdir(cwd);
2022
const bundle = await rollup({
2123
input,

packages/auto-install/test/yarn-bare.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ const input = path.join(cwd, '../input.js');
1515
const pkgFile = path.join(cwd, 'package.json');
1616

1717
const PREV_CWD = process.cwd();
18+
const [NODE_MAJOR, NODE_MINOR] = process.versions.node.split('.').map(Number);
19+
const RUN_ON_THIS_NODE = NODE_MAJOR > 20 || (NODE_MAJOR === 20 && NODE_MINOR >= 19);
1820

19-
it('yarn, bare', async () => {
21+
it.runIf(RUN_ON_THIS_NODE)('yarn, bare', async () => {
2022
process.chdir(cwd);
2123
// Ensure Yarn classic does not traverse to the repo root and read its
2224
// packageManager (pnpm). When no local package.json exists, Yarn v1 will

packages/auto-install/test/yarn.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ const input = path.join(cwd, '../input.js');
1515
const pkgFile = path.join(cwd, 'package.json');
1616

1717
const PREV_CWD = process.cwd();
18+
const [NODE_MAJOR, NODE_MINOR] = process.versions.node.split('.').map(Number);
19+
const RUN_ON_THIS_NODE = NODE_MAJOR > 20 || (NODE_MAJOR === 20 && NODE_MINOR >= 19);
1820

19-
it('yarn', async () => {
21+
it.runIf(RUN_ON_THIS_NODE)('yarn', async () => {
2022
process.chdir(cwd);
2123
// Pre-create a local package.json with an explicit Yarn v1 requirement so
2224
// the Yarn shim (Corepack) doesn't traverse to the repo root and pick up

0 commit comments

Comments
 (0)