Skip to content

Commit

Permalink
add missing test file
Browse files Browse the repository at this point in the history
  • Loading branch information
43081j committed Apr 14, 2020
1 parent 344ea5d commit 5cbc782
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/fake-timers-esm-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as timers from '../pkg/fake-timers-esm.js';

const expectedExports = ['timers', 'createClock', 'install', 'withGlobal'];

for (const exp of expectedExports) {
if (!timers[exp]) {
console.error(`Missing export in ES module: ${exp}`);
process.exit(1);
}
}

let hasRun = false;
const org = setTimeout;
const clock = timers.install();
setTimeout(() => (hasRun = true));
clock.tick();

if (!hasRun) {
console.error('Failed to tick timers in ES Module');
process.exit(1);
}

0 comments on commit 5cbc782

Please sign in to comment.