From 4fa9f9e9d83cfef76160178a0e64c59f61153d6a Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 22 Apr 2021 13:20:01 -0400 Subject: [PATCH] tests: Use `window.foo` instead of `var foo` --- src/node/hooks/express/tests.js | 2 +- src/tests/frontend/runner.js | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/node/hooks/express/tests.js b/src/node/hooks/express/tests.js index 6b570805b..59bd4cdc6 100644 --- a/src/node/hooks/express/tests.js +++ b/src/node/hooks/express/tests.js @@ -26,7 +26,7 @@ exports.expressCreateServer = (hookName, args, cb) => { console.debug('Sent browser the following test specs:', files); res.setHeader('content-type', 'application/javascript'); - res.end(`var frontendTestSpecs = ${JSON.stringify(files)};\n`); + res.end(`window.frontendTestSpecs = ${JSON.stringify(files)};\n`); }); const rootTestFolder = path.join(settings.root, 'src/tests/frontend/'); diff --git a/src/tests/frontend/runner.js b/src/tests/frontend/runner.js index cdc218cad..d8c542107 100644 --- a/src/tests/frontend/runner.js +++ b/src/tests/frontend/runner.js @@ -1,7 +1,5 @@ 'use strict'; -/* global frontendTestSpecs */ - $(() => { const stringifyException = (exception) => { let err = exception.stack || exception.toString(); @@ -144,7 +142,7 @@ $(() => { require.setGlobalKeyPath('require'); const $body = $('body'); - for (const spec of frontendTestSpecs.map((spec) => encodeURI(spec))) { + for (const spec of window.frontendTestSpecs.map((spec) => encodeURI(spec))) { $body.append($('