From 6bc87639c7fb7803e9dd0c31b3dca6bb2c25bbdb Mon Sep 17 00:00:00 2001 From: Ava Gaiety W Date: Tue, 14 May 2024 14:12:41 -0500 Subject: [PATCH] correct import paths for proxied color.js in karma --- test/integration/full/patch/patch.mjs | 11 +++-------- test/karma.conf.js | 6 ++++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/test/integration/full/patch/patch.mjs b/test/integration/full/patch/patch.mjs index b3f4fa91bd..98c3c3a116 100644 --- a/test/integration/full/patch/patch.mjs +++ b/test/integration/full/patch/patch.mjs @@ -2,7 +2,6 @@ // recommending to `null` out `window.CSS` for JSDOM's benefit // https://github.com/thymikee/jest-preset-angular/commit/ac30648347ab41e0cbce741f66ae2a06b766fe13#diff-f2981abe444e6cc2b341b0d7cadb3932d2f1fbb6601aebeaf70f8bb387439d35 -const karmaBaseURL = '/base'; const originalWindowCSS = window.CSS; function resetWindowCSSMock() { @@ -16,9 +15,7 @@ function mockWindowCSS() { describe('patch test', function () { it('when not mocked, imports and works as expected', async function () { try { - const { default: Color } = await import( - `${karmaBaseURL}/patches/unpatched/color.js` - ); + const { default: Color } = await import('/unpatched/color.js'); let color = new Color('slategray'); assert.ok(color); } catch (error) { @@ -42,7 +39,7 @@ describe('patch test', function () { it('not patched: `CSS.supports` fails to load when `window.CSS === null`', async function () { try { - `${karmaBaseURL}/patches/unpatched/color.js`; + await import('/unpatched/color.js'); } catch ({ name, message }) { assert.equal(name, 'TypeError'); assert.equal( @@ -54,9 +51,7 @@ describe('patch test', function () { it('patched: `CSS?.supports` optional chaining does not fail importing when `window.CSS === null`', async function () { try { - const { default: Color } = await import( - `${karmaBaseURL}/node_modules/colorjs.io/dist/color.js` - ); + const { default: Color } = await import('/color.js'); let color = new Color('slategray'); assert.ok(color); } catch (error) { diff --git a/test/karma.conf.js b/test/karma.conf.js index 529ee49a1f..9aebcdaa76 100644 --- a/test/karma.conf.js +++ b/test/karma.conf.js @@ -86,11 +86,11 @@ module.exports = function (config) { frameworks: ['mocha', 'chai', 'sinon'], files: [ { - pattern: 'node_modules/colorjs.io/dist/*', + pattern: 'node_modules/colorjs.io/dist/color.js', included: false, served: true }, - { pattern: 'patches/unpatched/*{js,cjs}', included: false, served: true }, + { pattern: 'patches/unpatched/*.js', included: false, served: true }, { pattern: 'test/mock/**/*.html', included: false, served: true }, { pattern: 'test/integration/**/*.css', included: false, served: true }, { @@ -109,6 +109,8 @@ module.exports = function (config) { 'test/testutils.js' ].concat(testPaths), proxies: { + '/color.js': '/base/node_modules/colorjs.io/dist/color.js', + '/unpatched': '/base/patches/unpatched', '/test': '/base/test', '/mock': '/base/test/mock', '/integration': '/base/test/integration',