mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
We want to start dogfooding `workerThreads`, but we can only safely do it if you have a new enough node version. We don't have any sort of strong enforcement around node.js version in front (e.g. you could have a misconfigured nvm or fnm), so we need to check the node version first. - https://github.com/napi-rs/napi-rs/issues/2555#issuecomment-3645173223 - https://github.com/nodejs/node/pull/55877 - https://github.com/nodejs/node/pull/61400 - https://github.com/nodejs/node/pull/61661 Looks like this:  Related Node.js version bump for front: https://github.com/vercel/front/pull/65059
34 lines
929 B
TypeScript
34 lines
929 B
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
|
|
describe.each([
|
|
['forceWorkerThreads', true],
|
|
['childProcesses', false],
|
|
] as const)(
|
|
'turbopack-node-backend (%s)',
|
|
(turbopackPluginRuntimeStrategy, expectSamePid) => {
|
|
const { next, isTurbopack } = nextTestSetup({
|
|
files: __dirname,
|
|
env: {
|
|
TEST_TURBOPACK_PLUGIN_RUNTIME_STRATEGY: turbopackPluginRuntimeStrategy,
|
|
},
|
|
})
|
|
|
|
const itOnlyTurbopack = isTurbopack ? it : it.skip
|
|
|
|
itOnlyTurbopack('should match expected loader pid behavior', async () => {
|
|
const response = await next.fetch('/api/pid')
|
|
expect(response.status).toBe(200)
|
|
|
|
const data = await response.json()
|
|
expect(data.buildPid).toBeDefined()
|
|
expect(data.loaderPid).toBeDefined()
|
|
|
|
if (expectSamePid) {
|
|
expect(data.loaderPid).toBe(data.buildPid)
|
|
} else {
|
|
expect(data.loaderPid).not.toBe(data.buildPid)
|
|
}
|
|
})
|
|
}
|
|
)
|