Skip to content

Commit

Permalink
Include debug script in test directories
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Nov 20, 2024
1 parent b5666ce commit 6c76cf2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
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

0 comments on commit 6c76cf2

Please sign in to comment.