Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 35 additions & 94 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@
"qunit": "3.0.0",
"react-refresh": "0.14.0",
"sass": "1.108.2",
"sinon": "16.1.3",
"sinon-test": "~3.1.6",
"sinon": "22.1.0",
"source-map-loader": "5.0.0",
"typescript": "6.0.3",
"update-browserslist-db": "1.4.0",
Expand Down
24 changes: 18 additions & 6 deletions tests/qunit/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,27 @@
<link rel="stylesheet" href="../../node_modules/qunit/qunit/qunit.css" type="text/css" media="screen" />
<script src="../../node_modules/qunit/qunit/qunit.js"></script>
<script src="../../node_modules/sinon/pkg/sinon.js"></script>
<script src="../../node_modules/sinon-test/dist/sinon-test.js"></script>
<script>
var qTest = QUnit.test, sTest = sinonTest( sinon );

QUnit.config.hidepassed = false;

QUnit.test = function( testName, callback ) {
return qTest( testName, sTest(callback) );
};
/*
* Every test runs with fake timers, available as `this.clock`, and any stubs or spies are
* restored after each test.
*
* `Intl` is excluded from the fake timers. When faked, the global `Intl` object is replaced
* with one that cannot be stubbed (`Intl.hasOwnProperty` is overwritten with a boolean), and
* its formatters do not inherit from `Intl.DateTimeFormat.prototype`.
*/
QUnit.hooks.beforeEach( function() {
this.clock = sinon.useFakeTimers( {
toNotFake: [ 'Intl' ]
} );
} );

QUnit.hooks.afterEach( function() {
this.clock.restore();
sinon.restore();
} );
</script>
</head>
<body>
Expand Down
4 changes: 2 additions & 2 deletions tests/qunit/wp-includes/js/wp-emoji.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ QUnit.module( 'wp-emoji mutation observer', {
* Waits for pending mutation records to be delivered to the observer.
*
* Records reach an observer in a microtask, so settling on one puts this behind the observer's own
* callback. A timer cannot be used to wait: every test here is wrapped by sinon-test, which swaps
* the timers for a fake clock that nothing in this file advances.
* callback. A timer cannot be used to wait: every test runs with sinon's fake timers (see
* tests/qunit/index.html), and nothing in this file advances the clock.
*
* @return {Promise} A promise which settles once the observer has run.
*/
Expand Down
Loading