Unverified Commit c482c207 authored by Zack Tanner's avatar Zack Tanner Committed by GitHub

[backport v14] fix: ensure lint worker errors aren't silenced (#75766) (#75779)

Backports:
- #75766
parent 5791cb67
...@@ -164,7 +164,7 @@ export async function verifyTypeScriptSetup({ ...@@ -164,7 +164,7 @@ export async function verifyTypeScriptSetup({
*/ */
// we are in a worker, print the error message and exit the process // we are in a worker, print the error message and exit the process
if (process.env.JEST_WORKER_ID) { if (process.env.IS_NEXT_WORKER) {
if (err instanceof Error) { if (err instanceof Error) {
console.error(err.message) console.error(err.message)
} else { } else {
......
...@@ -48,6 +48,7 @@ export class Worker { ...@@ -48,6 +48,7 @@ export class Worker {
env: { env: {
...((farmOptions.forkOptions?.env || {}) as any), ...((farmOptions.forkOptions?.env || {}) as any),
...process.env, ...process.env,
IS_NEXT_WORKER: 'true',
} as any, } as any,
}, },
}) as JestWorker }) as JestWorker
...@@ -73,7 +74,7 @@ export class Worker { ...@@ -73,7 +74,7 @@ export class Worker {
worker._child?.on('exit', (code, signal) => { worker._child?.on('exit', (code, signal) => {
if ((code || (signal && signal !== 'SIGINT')) && this._worker) { if ((code || (signal && signal !== 'SIGINT')) && this._worker) {
logger.error( logger.error(
`Static worker exited with code: ${code} and signal: ${signal}` `Next.js build worker exited with code: ${code} and signal: ${signal}`
) )
// We're restarting the worker, so we don't want to exit the parent process // We're restarting the worker, so we don't want to exit the parent process
...@@ -96,7 +97,7 @@ export class Worker { ...@@ -96,7 +97,7 @@ export class Worker {
if (!worker) return if (!worker) return
const resolve = resolveRestartPromise const resolve = resolveRestartPromise
logger.warn( logger.warn(
`Sending SIGTERM signal to static worker due to timeout${ `Sending SIGTERM signal to Next.js build worker due to timeout${
timeout ? ` of ${timeout / 1000} seconds` : '' timeout ? ` of ${timeout / 1000} seconds` : ''
}. Subsequent errors may be a result of the worker exiting.` }. Subsequent errors may be a result of the worker exiting.`
) )
......
...@@ -13,10 +13,10 @@ describe('worker-restart', () => { ...@@ -13,10 +13,10 @@ describe('worker-restart', () => {
const output = stdout + stderr const output = stdout + stderr
expect(output).toContain( expect(output).toContain(
'Sending SIGTERM signal to static worker due to timeout of 10 seconds. Subsequent errors may be a result of the worker exiting.' 'Sending SIGTERM signal to Next.js build worker due to timeout of 10 seconds. Subsequent errors may be a result of the worker exiting.'
) )
expect(output).toContain( expect(output).toContain(
'Static worker exited with code: null and signal: SIGTERM' 'Next.js build worker exited with code: null and signal: SIGTERM'
) )
expect(output).toContain( expect(output).toContain(
'Restarted static page generation for /bad-page because it took more than 10 seconds' 'Restarted static page generation for /bad-page because it took more than 10 seconds'
...@@ -41,7 +41,7 @@ describe('worker-restart', () => { ...@@ -41,7 +41,7 @@ describe('worker-restart', () => {
const output = stdout + stderr const output = stdout + stderr
expect(output).toContain( expect(output).toContain(
'Static worker exited with code: null and signal: SIGKILL' 'Next.js build worker exited with code: null and signal: SIGKILL'
) )
}) })
}) })
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