Skip to content

Commit 912c568

Browse files
authored
upgrade fake timers and others (#2612)
* Upgrade dependencies (includes breaking API in Fake Timers) * fake-timers: no longer creating dates using the original Date class, but a subclass (proxy) * Clarify intent and fix breaking test on global restore This was originally added (really rectified) in commit ac17669 (2013) when Sinon's fake-timers code allowed installing non-standard/unknown timers. Since the latest fake-timers no longer allows this, we have to do the test against a real/existing timer that the library knows about. We supply a custom global to avoid any of the mentioned side effects of trying to delete built-ins in some environments. * Clarify intent and fix breaking test concerning non-inherited timer * fix test: fake-timers now installs all timers by default (including nextTick) * Various micro-fixes in the tests * Exclude Node timers and timers/promises modules from bundle
1 parent c9fd3a9 commit 912c568

File tree

4 files changed

+574
-440
lines changed

4 files changed

+574
-440
lines changed

build.cjs

+12-9
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@ try {
2424
* @param done
2525
*/
2626
function makeBundle(entryPoint, config, done) {
27-
browserify(entryPoint, config).bundle(function (err, buffer) {
28-
if (err) {
29-
throw err;
30-
}
31-
done(buffer.toString());
32-
});
27+
browserify(entryPoint, config)
28+
.exclude("timers")
29+
.exclude("timers/promises")
30+
.bundle(function (err, buffer) {
31+
if (err) {
32+
throw err;
33+
}
34+
done(buffer.toString());
35+
});
3336
}
3437

3538
makeBundle(
@@ -45,7 +48,7 @@ makeBundle(
4548
function (bundle) {
4649
var script = preamble + bundle;
4750
fs.writeFileSync("pkg/sinon.js", script); // WebWorker can only load js files
48-
}
51+
},
4952
);
5053

5154
makeBundle(
@@ -59,7 +62,7 @@ makeBundle(
5962
function (bundle) {
6063
var script = preamble + bundle;
6164
fs.writeFileSync("pkg/sinon-no-sourcemaps.cjs", script);
62-
}
65+
},
6366
);
6467

6568
makeBundle(
@@ -78,5 +81,5 @@ makeBundle(
7881

7982
var script = preamble + intro + bundle + outro;
8083
fs.writeFileSync("pkg/sinon-esm.js", script);
81-
}
84+
},
8285
);

0 commit comments

Comments
 (0)