Skip to content
Merged
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
19 changes: 1 addition & 18 deletions lib/createJestRunner.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type * as JestResult from '@jest/test-result';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we ditch the dep as well, or os it used elsewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is necessary elsewhere:

import type { TestResult } from '@jest/test-result';

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks for checking 👍

import type { Config } from '@jest/types';
import type * as JestRunner from 'jest-runner';
import { Worker } from 'jest-worker';
Expand Down Expand Up @@ -136,22 +135,6 @@ export default function createRunner<
});
});

const onError = (
err: JestResult.SerializableError,
test: JestRunner.Test,
) => {
return onFailure(test, err).then(() => {
if (err.type === 'ProcessTerminatedError') {
// eslint-disable-next-line no-console
console.error(
'A worker process has quit unexpectedly! ' +
'Most likely this is an initialization error.',
);
process.exit(1);
}
});
};

const onInterrupt = new Promise((_, reject) => {
watcher.on('change', state => {
if (state.interrupted) {
Expand All @@ -164,7 +147,7 @@ export default function createRunner<
tests.map(test =>
runTestInWorker(test)
.then(testResult => onResult(test, testResult))
.catch(error => onError(error, test)),
.catch(error => onFailure(test, error)),
),
);

Expand Down