Skip to content

Commit

Permalink
move out of mocha dir
Browse files Browse the repository at this point in the history
  • Loading branch information
43081j committed Apr 25, 2020
1 parent 5cbc782 commit 7d410df
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
18 changes: 16 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"test-check-coverage": "npm run test-coverage && nyc check-coverage",
"test-cloud": "mochify --wd --no-detect-globals --timeout=10000",
"test-coverage": "nyc --all --reporter text --reporter html --reporter lcovonly npm run test-node",
"test-esm": "node -r esm test/fake-timers-esm-test.js",
"test-esm": "node -r esm test-esm/fake-timers-esm-test.js",
"test": "npm run lint && npm run test-node && npm run test-headless && npm run test-esm",
"bundle": "node ./build.js",
"prepublishOnly": "npm run bundle",
Expand Down Expand Up @@ -72,7 +72,19 @@
"ie11/no-weak-collections": [
"error"
]
}
},
"overrides": [
{
"files": "test-esm/*",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"modules": true
}
}
}
]
},
"module": "./pkg/fake-timers-esm.js",
"cdn": "./pkg/fake-timers.js",
Expand All @@ -93,6 +105,8 @@
"statements": 92,
"exclude": [
"**/*-test.js",
"**/*-test-esm.js",
"build.js",
"coverage/**",
"pkg/**"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as timers from '../pkg/fake-timers-esm.js';
/* eslint-disable no-console */
import * as timers from "../pkg/fake-timers-esm.js";

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

for (const exp of expectedExports) {
if (!timers[exp]) {
Expand All @@ -10,12 +11,11 @@ for (const exp of expectedExports) {
}

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');
console.error("Failed to tick timers in ES Module");
process.exit(1);
}

0 comments on commit 7d410df

Please sign in to comment.