Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Include debug script in test directories #72992

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contributing/core/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ these can be leveraged by prefixing the `pnpm test` command.

- When investigating failures in isolated tests you can use
`NEXT_TEST_SKIP_CLEANUP=1` to prevent deleting the temp folder created for the test,
then you can run `pnpm next` while inside the temp folder to debug the fully set-up test project.
then you can run `pnpm debug` while inside the temp folder to debug the fully set-up test project.
- You can also use `NEXT_SKIP_ISOLATE=1` if the test doesn't need to be installed to debug,
and it will run inside the Next.js repo instead of the temp directory,
this can also reduce test times locally but is not compatible with all tests.
Expand Down
6 changes: 6 additions & 0 deletions test/lib/create-next-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,18 @@ async function createNextInstall({
}, {}),
}

const scripts = {
debug: `NEXT_PRIVATE_SKIP_CANARY_CHECK=1 NEXT_TELEMETRY_DISABLED=1 NEXT_TEST_NATIVE_DIR=${process.env.NEXT_TEST_NATIVE_DIR} node --inspect --trace-deprecation --enable-source-maps node_modules/next/dist/bin/next`,
...packageJson.scripts,
}

await fs.ensureDir(installDir)
await fs.writeFile(
path.join(installDir, 'package.json'),
JSON.stringify(
{
...packageJson,
scripts,
dependencies: combinedDependencies,
private: true,
// Add resolutions if provided.
Expand Down
Loading