Skip to content

Commit

Permalink
refactor: show error message from jest-worker
Browse files Browse the repository at this point in the history
  • Loading branch information
pustovalov committed Dec 27, 2019
1 parent 0e2da43 commit 013757b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/TaskRunner.js
Expand Up @@ -33,7 +33,12 @@ export default class TaskRunner {

async run(tasks) {
if (this.numberWorkers > 1) {
this.worker = new Worker(workerPath, { numWorkers: this.numberWorkers });
this.worker = new Worker(workerPath, {
numWorkers: this.numberWorkers,
forkOptions: {
silent: false,
},
});
}

return Promise.all(
Expand Down
6 changes: 6 additions & 0 deletions test/parallel-option-failure.test.js
Expand Up @@ -70,6 +70,9 @@ describe('parallel option', () => {
expect(Worker).toHaveBeenCalledTimes(1);
expect(Worker).toHaveBeenLastCalledWith(workerPath, {
numWorkers: os.cpus().length - 1,
forkOptions: {
silent: false,
},
});
expect(workerTransform).toHaveBeenCalledTimes(
Object.keys(stats.compilation.assets).length
Expand All @@ -89,6 +92,9 @@ describe('parallel option', () => {
expect(Worker).toHaveBeenCalledTimes(1);
expect(Worker).toHaveBeenLastCalledWith(workerPath, {
numWorkers: os.cpus().length - 1,
forkOptions: {
silent: false,
},
});
expect(workerTransform).toHaveBeenCalledTimes(
Object.keys(stats.compilation.assets).length
Expand Down
15 changes: 15 additions & 0 deletions test/parallel-option.test.js
Expand Up @@ -70,6 +70,9 @@ describe('parallel option', () => {
expect(Worker).toHaveBeenCalledTimes(1);
expect(Worker).toHaveBeenLastCalledWith(workerPath, {
numWorkers: os.cpus().length - 1,
forkOptions: {
silent: false,
},
});
expect(workerTransform).toHaveBeenCalledTimes(
Object.keys(stats.compilation.assets).length
Expand Down Expand Up @@ -101,6 +104,9 @@ describe('parallel option', () => {
expect(Worker).toHaveBeenCalledTimes(1);
expect(Worker).toHaveBeenLastCalledWith(workerPath, {
numWorkers: os.cpus().length - 1,
forkOptions: {
silent: false,
},
});
expect(workerTransform).toHaveBeenCalledTimes(
Object.keys(stats.compilation.assets).length
Expand All @@ -120,6 +126,9 @@ describe('parallel option', () => {
expect(Worker).toHaveBeenCalledTimes(1);
expect(Worker).toHaveBeenLastCalledWith(workerPath, {
numWorkers: 2,
forkOptions: {
silent: false,
},
});
expect(workerTransform).toHaveBeenCalledTimes(
Object.keys(stats.compilation.assets).length
Expand All @@ -143,6 +152,9 @@ describe('parallel option', () => {
expect(Worker).toHaveBeenCalledTimes(1);
expect(Worker).toHaveBeenLastCalledWith(workerPath, {
numWorkers: os.cpus().length - 1,
forkOptions: {
silent: false,
},
});
expect(workerTransform).toHaveBeenCalledTimes(
Object.keys(stats.compilation.assets).length
Expand All @@ -169,6 +181,9 @@ describe('parallel option', () => {
expect(Worker).toHaveBeenCalledTimes(1);
expect(Worker).toHaveBeenLastCalledWith(workerPath, {
numWorkers: os.cpus().length - 1,
forkOptions: {
silent: false,
},
});
expect(workerTransform).toHaveBeenCalledTimes(
Object.keys(stats.compilation.assets).length
Expand Down

0 comments on commit 013757b

Please sign in to comment.