Skip to content

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

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

Merged
merged 3 commits into from
Feb 10, 2025
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 packages/next/src/lib/verify-typescript-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export async function verifyTypeScriptSetup({
*/

// 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) {
console.error(err.message)
} else {
Expand Down
5 changes: 3 additions & 2 deletions packages/next/src/lib/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export class Worker {
env: {
...((farmOptions.forkOptions?.env || {}) as any),
...process.env,
IS_NEXT_WORKER: 'true',
} as any,
},
}) as JestWorker
Expand All @@ -73,7 +74,7 @@ export class Worker {
worker._child?.on('exit', (code, signal) => {
if ((code || (signal && signal !== 'SIGINT')) && this._worker) {
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
Expand All @@ -96,7 +97,7 @@ export class Worker {
if (!worker) return
const resolve = resolveRestartPromise
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` : ''
}. Subsequent errors may be a result of the worker exiting.`
)
Expand Down
6 changes: 3 additions & 3 deletions test/production/app-dir/worker-restart/worker-restart.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ describe('worker-restart', () => {

const output = stdout + stderr
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(
'Static worker exited with code: null and signal: SIGTERM'
'Next.js build worker exited with code: null and signal: SIGTERM'
)
expect(output).toContain(
'Restarted static page generation for /bad-page because it took more than 10 seconds'
Expand All @@ -41,7 +41,7 @@ describe('worker-restart', () => {

const output = stdout + stderr
expect(output).toContain(
'Static worker exited with code: null and signal: SIGKILL'
'Next.js build worker exited with code: null and signal: SIGKILL'
)
})
})
Loading