Unverified Commit 8d28d595 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

test: rename node_modules_bak to node_modules (#62066)

We switched to `pnpm` for testing instead of `yarn` for e2e tests
containing customized node_modules packages, it works with
`node_modules` folder before. Rename the existing `node_modules_bak`
hack to make it easy to test with.

Previously we use `yarn` but it will clean `node_modules` folder so we
have to use another script to copy packages, it's not a required thing
now so we can test package from node_modules directly without renaming
folders locally

Closes NEXT-2496
parent aca53364
...@@ -17,11 +17,8 @@ createNextDescribe( ...@@ -17,11 +17,8 @@ createNextDescribe(
files: new FileRef(path.join(__dirname, 'fixtures', 'rsc-runtime-errors')), files: new FileRef(path.join(__dirname, 'fixtures', 'rsc-runtime-errors')),
packageJson: { packageJson: {
scripts: { scripts: {
copy: 'cp -r ./node_modules_bak/* ./node_modules', build: 'next build',
build: 'pnpm copy && next build', dev: `next ${shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'}`,
dev: `pnpm copy && next ${
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
}`,
start: 'next start', start: 'next start',
}, },
}, },
......
...@@ -16,11 +16,8 @@ createNextDescribe( ...@@ -16,11 +16,8 @@ createNextDescribe(
}, },
packageJson: { packageJson: {
scripts: { scripts: {
copy: `cp -r ./node_modules_bak/* ./node_modules`, build: 'next build',
build: 'pnpm copy && next build', dev: `next ${shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'}`,
dev: `pnpm copy && next ${
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
}`,
start: 'next start', start: 'next start',
}, },
}, },
......
...@@ -14,11 +14,8 @@ import { hasRedbox, shouldRunTurboDevTest } from 'next-test-utils' ...@@ -14,11 +14,8 @@ import { hasRedbox, shouldRunTurboDevTest } from 'next-test-utils'
files: join(__dirname, 'fixture'), files: join(__dirname, 'fixture'),
packageJson: { packageJson: {
scripts: { scripts: {
copy: `cp -r ./node_modules_bak/* ./node_modules`, build: `next build`,
build: `pnpm copy && next build`, dev: `next ${shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'}`,
dev: `pnpm copy && next ${
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
}`,
start: 'next start', start: 'next start',
}, },
}, },
......
...@@ -24,11 +24,8 @@ createNextDescribe( ...@@ -24,11 +24,8 @@ createNextDescribe(
}, },
packageJson: { packageJson: {
scripts: { scripts: {
copy: `cp -r ./node_modules_bak/* ./node_modules`, build: 'next build',
build: 'pnpm copy && next build', dev: `next ${shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'}`,
dev: `pnpm copy && next ${
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
}`,
start: 'next start', start: 'next start',
}, },
}, },
......
...@@ -25,22 +25,19 @@ describe('Edge compiler module exports preference', () => { ...@@ -25,22 +25,19 @@ describe('Edge compiler module exports preference', () => {
}) })
} }
`, `,
'my-lib/package.json': JSON.stringify({ 'node_modules/my-lib/package.json': JSON.stringify({
name: 'my-lib', name: 'my-lib',
version: '1.0.0', version: '1.0.0',
main: 'index.js', main: 'index.js',
browser: 'browser.js', browser: 'browser.js',
}), }),
'my-lib/index.js': `module.exports = "Node.js"`, 'node_modules/my-lib/index.js': `module.exports = "Node.js"`,
'my-lib/browser.js': `module.exports = "Browser"`, 'node_modules/my-lib/browser.js': `module.exports = "Browser"`,
}, },
packageJson: { packageJson: {
scripts: { scripts: {
copy: `cp -r ./my-lib ./node_modules`, build: 'next build',
build: 'pnpm copy && next build', dev: `next ${shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'}`,
dev: `pnpm copy && next ${
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
}`,
start: 'next start', start: 'next start',
}, },
}, },
......
...@@ -7,11 +7,8 @@ createNextDescribe( ...@@ -7,11 +7,8 @@ createNextDescribe(
files: __dirname, files: __dirname,
packageJson: { packageJson: {
scripts: { scripts: {
copy: 'cp -r ./node_modules_bak/* ./node_modules', build: 'next build',
build: 'pnpm copy && next build', dev: `next ${shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'}`,
dev: `pnpm copy && next ${
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
}`,
start: 'next start', start: 'next start',
}, },
}, },
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment