Skip to content

Commit c482c20

Browse files
authored
[backport v14] fix: ensure lint worker errors aren't silenced (#75766) (#75779)
Backports: - #75766
1 parent 5791cb6 commit c482c20

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

packages/next/src/lib/verify-typescript-setup.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export async function verifyTypeScriptSetup({
164164
*/
165165

166166
// we are in a worker, print the error message and exit the process
167-
if (process.env.JEST_WORKER_ID) {
167+
if (process.env.IS_NEXT_WORKER) {
168168
if (err instanceof Error) {
169169
console.error(err.message)
170170
} else {

packages/next/src/lib/worker.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export class Worker {
4848
env: {
4949
...((farmOptions.forkOptions?.env || {}) as any),
5050
...process.env,
51+
IS_NEXT_WORKER: 'true',
5152
} as any,
5253
},
5354
}) as JestWorker
@@ -73,7 +74,7 @@ export class Worker {
7374
worker._child?.on('exit', (code, signal) => {
7475
if ((code || (signal && signal !== 'SIGINT')) && this._worker) {
7576
logger.error(
76-
`Static worker exited with code: ${code} and signal: ${signal}`
77+
`Next.js build worker exited with code: ${code} and signal: ${signal}`
7778
)
7879

7980
// We're restarting the worker, so we don't want to exit the parent process
@@ -96,7 +97,7 @@ export class Worker {
9697
if (!worker) return
9798
const resolve = resolveRestartPromise
9899
logger.warn(
99-
`Sending SIGTERM signal to static worker due to timeout${
100+
`Sending SIGTERM signal to Next.js build worker due to timeout${
100101
timeout ? ` of ${timeout / 1000} seconds` : ''
101102
}. Subsequent errors may be a result of the worker exiting.`
102103
)

test/production/app-dir/worker-restart/worker-restart.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ describe('worker-restart', () => {
1313

1414
const output = stdout + stderr
1515
expect(output).toContain(
16-
'Sending SIGTERM signal to static worker due to timeout of 10 seconds. Subsequent errors may be a result of the worker exiting.'
16+
'Sending SIGTERM signal to Next.js build worker due to timeout of 10 seconds. Subsequent errors may be a result of the worker exiting.'
1717
)
1818
expect(output).toContain(
19-
'Static worker exited with code: null and signal: SIGTERM'
19+
'Next.js build worker exited with code: null and signal: SIGTERM'
2020
)
2121
expect(output).toContain(
2222
'Restarted static page generation for /bad-page because it took more than 10 seconds'
@@ -41,7 +41,7 @@ describe('worker-restart', () => {
4141

4242
const output = stdout + stderr
4343
expect(output).toContain(
44-
'Static worker exited with code: null and signal: SIGKILL'
44+
'Next.js build worker exited with code: null and signal: SIGKILL'
4545
)
4646
})
4747
})

0 commit comments

Comments
 (0)