diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..e9ee3cb --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +legacy-peer-deps=true \ No newline at end of file diff --git a/web-test-runner.config.js b/web-test-runner.config.js index 9dc1413..7c45748 100644 --- a/web-test-runner.config.js +++ b/web-test-runner.config.js @@ -1,10 +1,10 @@ import { defaultReporter } from '@web/test-runner'; import fs from 'fs/promises'; -import { greenwoodPluginImportCss } from '@greenwood/plugin-import-css/src/index.js'; +import { greenwoodPluginImportRaw } from '@greenwood/plugin-import-raw'; import { junitReporter } from '@web/test-runner-junit-reporter'; // create a direct instance of ImportCssResource -const importCssResource = greenwoodPluginImportCss()[0].provider({}); +const importRawResource = greenwoodPluginImportRaw()[0].provider({}); export default { files: './src/**/*.spec.js', @@ -20,16 +20,16 @@ export default { reportDir: './reports' }, plugins: [{ - name: 'import-css', + name: 'import-raw-css', async transform(context) { const url = new URL(`.${context.request.url}`, import.meta.url); - const request = new Request(url, { headers: new Headers(context.headers) }); - const shouldIntercept = await importCssResource.shouldIntercept(url, request); + const request = new Request(url, { headers: { 'Sec-Fetch-Dest': 'empty' } }); + const shouldIntercept = await importRawResource.shouldIntercept(url, request); if (shouldIntercept) { const contents = await fs.readFile(url); const initResponse = new Response(contents, { headers: new Headers(context.headers) }); - const response = await importCssResource.intercept(url, request, initResponse.clone()); + const response = await importRawResource.intercept(url, request, initResponse.clone()); return { body: await response.text(),