Skip to content

Commit ef1bb8c

Browse files
authored
Don’t use microtime so we don’t depend on native modules. (#1203)
1 parent a392eb2 commit ef1bb8c

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

packages/jest-jasmine2/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
"graceful-fs": "^4.1.3",
1212
"jasmine-check": "^0.1.4",
1313
"jest-snapshot": "^12.1.0",
14-
"jest-util": "^12.1.0",
15-
"microtime": "^2.1.1"
14+
"jest-util": "^12.1.0"
1615
},
1716
"jest": {
1817
"rootDir": "./build",

packages/jest-jasmine2/src/reporter.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import type {
1919
TestResult,
2020
} from 'types/TestResult';
2121

22-
const microtime = require('microtime');
2322
const jasmineRequire = require('../vendor/jasmine-2.4.1.js');
2423
const jasmine = jasmineRequire.core(jasmineRequire);
2524
const JasmineFormatter = require('jest-util').JasmineFormatter;
@@ -56,7 +55,7 @@ class Jasmine2Reporter {
5655
}
5756

5857
specStarted(spec: {id: string}) {
59-
this._startTimes.set(spec.id, microtime.now());
58+
this._startTimes.set(spec.id, Date.now());
6059
}
6160

6261
specDone(result: SpecResult): void {
@@ -108,7 +107,7 @@ class Jasmine2Reporter {
108107
ancestorTitles: Array<string>,
109108
): AssertionResult {
110109
const start = this._startTimes.get(specResult.id);
111-
const duration = start ? (microtime.now() - start) / 1000 : undefined;
110+
const duration = start ? (Date.now() - start) : undefined;
112111
const status =
113112
(specResult.status === 'disabled') ? 'pending' : specResult.status;
114113
const results = {

0 commit comments

Comments
 (0)