Skip to content

Commit

Permalink
test: Make use of utility sleep function
Browse files Browse the repository at this point in the history
  • Loading branch information
nicojs committed Jul 24, 2018
1 parent 91495dd commit 7ff3098
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 2 additions & 3 deletions packages/stryker/test/unit/SandboxPoolSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Task } from '../../src/utils/Task';
import '../helpers/globals';
import { Mock, config, file, mock, testFramework } from '../helpers/producers';
import LoggingClientContext from '../../src/logging/LoggingClientContext';
import { sleep } from '../../src/utils/objectUtils';

const OVERHEAD_TIME_MS = 42;
const LOGGING_CONTEXT: LoggingClientContext = Object.freeze({
Expand Down Expand Up @@ -117,8 +118,6 @@ describe('SandboxPool', () => {
});

function tick() {
return new Promise(res => {
setTimeout(res, 0);
});
return sleep(0);
}

6 changes: 2 additions & 4 deletions packages/stryker/test/unit/transpiler/MutantTranspilerSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ChildProcessProxy from '../../../src/child-proxy/ChildProcessProxy';
import MutantTranspiler from '../../../src/transpiler/MutantTranspiler';
import TranspileResult from '../../../src/transpiler/TranspileResult';
import TranspilerFacade, * as transpilerFacade from '../../../src/transpiler/TranspilerFacade';
import { errorToString } from '../../../src/utils/objectUtils';
import { errorToString, sleep } from '../../../src/utils/objectUtils';
import '../../helpers/globals';
import { Mock, config, file, mock, testableMutant } from '../../helpers/producers';
import LoggingClientContext from '../../../src/logging/LoggingClientContext';
Expand Down Expand Up @@ -157,9 +157,7 @@ describe('MutantTranspiler', () => {
];
expect(actualResults).deep.eq(expectedResults);
});
const nextTick = () => new Promise(res => {
setTimeout(res, 0);
});
const nextTick = () => sleep(0);
});
});

Expand Down

0 comments on commit 7ff3098

Please sign in to comment.