mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-12 16:52:50 +00:00
enable --no-isolate to speed up unit tests
This required fixing deferred code that was running after the unit test had unmounted
This commit is contained in:
committed by
Martin Raifer
parent
e839b63079
commit
108893c624
@@ -653,6 +653,9 @@ export function rendererMap(context) {
|
||||
|
||||
|
||||
function redraw(difference, extent) {
|
||||
// in unit tests, we need to abort if the test has already completed
|
||||
if (typeof window === 'undefined') return;
|
||||
|
||||
if (surface.empty() || !_redrawEnabled) return;
|
||||
|
||||
// If we are in the middle of a zoom/pan, we can't do differenced redraws.
|
||||
|
||||
@@ -8,6 +8,9 @@ export function utilSessionMutex(name) {
|
||||
var intervalID;
|
||||
|
||||
function renew() {
|
||||
// in unit tests, we need to abort if the test has already completed
|
||||
if (typeof window === 'undefined') return;
|
||||
|
||||
var expires = new Date();
|
||||
expires.setSeconds(expires.getSeconds() + 5);
|
||||
document.cookie = name + '=1; expires=' + expires.toUTCString() + '; sameSite=strict';
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
"start:watch": "run-p build:js:watch start:server",
|
||||
"start:server": "node scripts/server.js",
|
||||
"test": "npm-run-all -s lint build test:spec",
|
||||
"test:spec": "vitest",
|
||||
"test:spec": "vitest --no-isolate",
|
||||
"translations": "node scripts/update_locales.js"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -21,6 +21,9 @@ describe('iD.servicePanoramax', function() {
|
||||
panoramax = iD.services.panoramax;
|
||||
panoramax.reset();
|
||||
fetchMock.reset();
|
||||
|
||||
// never resolve
|
||||
fetchMock.mock(/api\.panoramax\.xyz/, new Promise(() => {}));
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
|
||||
Reference in New Issue
Block a user