From e810a2aceaa3b7553c6146aa8ac16517df50c863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ari=20Perkki=C3=B6?= Date: Sun, 14 Jul 2024 10:22:34 +0300 Subject: [PATCH] fix(coverage): v8 sourcemaps with multiple sources --- package.json | 2 +- packages/coverage-v8/src/provider.ts | 29 +- pnpm-lock.yaml | 260 +++++++------ test/config/test/exec-args.test.ts | 4 + .../fixtures/src/pre-bundle/bundle.js | 30 ++ .../fixtures/src/pre-bundle/bundle.js.map | 17 + .../fixtures/src/pre-bundle/bundle.ts | 2 + .../fixtures/src/pre-bundle/first.ts | 7 + .../fixtures/src/pre-bundle/second.ts | 7 + .../bundled-istanbul.snapshot.json | 168 +++++++++ .../__snapshots__/bundled-v8.snapshot.json | 346 ++++++++++++++++++ .../test/bundled-sources.test.ts | 36 ++ test/coverage-test/vitest.workspace.custom.ts | 1 + 13 files changed, 763 insertions(+), 146 deletions(-) create mode 100644 test/coverage-test/fixtures/src/pre-bundle/bundle.js create mode 100644 test/coverage-test/fixtures/src/pre-bundle/bundle.js.map create mode 100644 test/coverage-test/fixtures/src/pre-bundle/bundle.ts create mode 100644 test/coverage-test/fixtures/src/pre-bundle/first.ts create mode 100644 test/coverage-test/fixtures/src/pre-bundle/second.ts create mode 100644 test/coverage-test/test/__snapshots__/bundled-istanbul.snapshot.json create mode 100644 test/coverage-test/test/__snapshots__/bundled-v8.snapshot.json create mode 100644 test/coverage-test/test/bundled-sources.test.ts diff --git a/package.json b/package.json index 5df52b2b61e7..a029944f1ba0 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "rollup-plugin-license": "^3.5.2", "tsx": "^4.16.5", "typescript": "^5.5.4", - "vite": "^5.3.3", + "vite": "^5.4.0", "vitest": "workspace:*", "zx": "^8.1.4" }, diff --git a/packages/coverage-v8/src/provider.ts b/packages/coverage-v8/src/provider.ts index ca038ed47902..d38d2a0a0db9 100644 --- a/packages/coverage-v8/src/provider.ts +++ b/packages/coverage-v8/src/provider.ts @@ -457,39 +457,44 @@ export class V8CoverageProvider extends BaseCoverageProvider implements Coverage const map = transformResult?.map as EncodedSourceMap | undefined const code = transformResult?.code - const sourcesContent - = map?.sourcesContent?.[0] - || (await fs.readFile(filePath, 'utf-8').catch(() => { + const sourcesContent = map?.sourcesContent || [] + + if (!sourcesContent[0]) { + sourcesContent[0] = await fs.readFile(filePath, 'utf-8').catch(() => { // If file does not exist construct a dummy source for it. // These can be files that were generated dynamically during the test run and were removed after it. const length = findLongestFunctionLength(functions) return '.'.repeat(length) - })) + }) + } // These can be uncovered files included by "all: true" or files that are loaded outside vite-node if (!map) { return { isExecuted, - source: code || sourcesContent, - originalSource: sourcesContent, + source: code || sourcesContent[0], + originalSource: sourcesContent[0], } } - const sources = [url] - if (map.sources && map.sources[0] && !url.endsWith(map.sources[0])) { - sources[0] = new URL(map.sources[0], url).href + const sources = (map.sources || []) + .filter(source => source != null) + .map(source => new URL(source, url).href) + + if (sources.length === 0) { + sources.push(url) } return { isExecuted, - originalSource: sourcesContent, - source: code || sourcesContent, + originalSource: sourcesContent[0], + source: code || sourcesContent[0], sourceMap: { sourcemap: excludeGeneratedCode(code, { ...map, version: 3, sources, - sourcesContent: [sourcesContent], + sourcesContent, }), }, } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4b7c8ef78c24..503be041058b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,7 +8,7 @@ overrides: acorn: 8.11.3 mlly: ^1.7.1 rollup: ^4.20.0 - vite: ^5.3.3 + vite: ^5.4.0 vitest: workspace:* patchedDependencies: @@ -111,8 +111,8 @@ importers: specifier: ^5.5.4 version: 5.5.4 vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vitest: specifier: workspace:* version: link:packages/vitest @@ -146,10 +146,10 @@ importers: version: 0.2.4 '@vite-pwa/vitepress': specifier: ^0.5.0 - version: 0.5.0(@vite-pwa/assets-generator@0.2.4)(vite-plugin-pwa@0.20.1(@vite-pwa/assets-generator@0.2.4)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.1.0)) + version: 0.5.0(@vite-pwa/assets-generator@0.2.4)(vite-plugin-pwa@0.20.1(@vite-pwa/assets-generator@0.2.4)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.1.0)) '@vitejs/plugin-vue': specifier: ^5.1.2 - version: 5.1.2(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))(vue@3.4.37(typescript@5.5.4)) + version: 5.1.2(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))(vue@3.4.37(typescript@5.5.4)) fast-glob: specifier: ^3.3.2 version: 3.3.2 @@ -158,16 +158,16 @@ importers: version: 4.7.1 unocss: specifier: ^0.61.9 - version: 0.61.9(postcss@8.4.40)(rollup@4.20.0)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)) + version: 0.61.9(postcss@8.4.40)(rollup@4.20.0)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)) unplugin-vue-components: specifier: ^0.27.3 version: 0.27.3(@babel/parser@7.25.3)(rollup@4.20.0)(vue@3.4.37(typescript@5.5.4)) vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vite-plugin-pwa: specifier: ^0.20.1 - version: 0.20.1(@vite-pwa/assets-generator@0.2.4)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.1.0) + version: 0.20.1(@vite-pwa/assets-generator@0.2.4)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.1.0) vitepress: specifier: ^1.3.1 version: 1.3.1(@algolia/client-search@4.20.0)(@types/node@20.14.14)(@types/react@18.2.79)(postcss@8.4.40)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.9.0)(terser@5.22.0)(typescript@5.5.4) @@ -184,8 +184,8 @@ importers: specifier: latest version: 2.0.5(vitest@packages+vitest) vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -205,8 +205,8 @@ importers: specifier: ^4.7.2 version: 4.7.2 vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -236,8 +236,8 @@ importers: specifier: latest version: 24.1.1 vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -262,7 +262,7 @@ importers: devDependencies: '@preact/preset-vite': specifier: ^2.8.2 - version: 2.8.2(@babel/core@7.24.5)(preact@10.21.0)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)) + version: 2.8.2(@babel/core@7.24.5)(preact@10.21.0)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)) '@testing-library/jest-dom': specifier: ^6.4.2 version: 6.4.2(@types/jest@29.0.0)(vitest@packages+vitest) @@ -276,8 +276,8 @@ importers: specifier: ^5.4.5 version: 5.4.5 vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -307,8 +307,8 @@ importers: specifier: ^24.0.0 version: 24.0.0 vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -329,11 +329,11 @@ importers: specifier: latest version: 24.1.1 vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vite-plugin-solid: specifier: ^2.7.2 - version: 2.7.2(solid-js@1.8.3)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)) + version: 2.7.2(solid-js@1.8.3)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -342,10 +342,10 @@ importers: devDependencies: '@sveltejs/adapter-auto': specifier: ^2.1.0 - version: 2.1.0(@sveltejs/kit@1.20.2(svelte@3.59.1)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))) + version: 2.1.0(@sveltejs/kit@1.20.2(svelte@3.59.1)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))) '@sveltejs/kit': specifier: ^1.20.2 - version: 1.20.2(svelte@3.59.1)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)) + version: 1.20.2(svelte@3.59.1)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)) svelte: specifier: ^3.59.1 version: 3.59.1 @@ -359,8 +359,8 @@ importers: specifier: ^5.2.2 version: 5.2.2 vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -377,8 +377,8 @@ importers: specifier: ^5.2.2 version: 5.2.2 vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.11.5)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.11.5)(terser@5.22.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -399,7 +399,7 @@ importers: version: 18.2.79 '@vitejs/plugin-react': specifier: ^4.2.1 - version: 4.2.1(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)) + version: 4.2.1(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)) '@vitest/ui': specifier: latest version: 2.0.5(vitest@packages+vitest) @@ -419,8 +419,8 @@ importers: specifier: ^4.7.2 version: 4.7.2 vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -754,7 +754,7 @@ importers: version: 0.61.9 '@vitejs/plugin-vue': specifier: ^5.1.2 - version: 5.1.2(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))(vue@3.4.37(typescript@5.5.4)) + version: 5.1.2(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))(vue@3.4.37(typescript@5.5.4)) '@vitest/runner': specifier: workspace:* version: link:../runner @@ -790,7 +790,7 @@ importers: version: 3.1.5 unocss: specifier: ^0.61.9 - version: 0.61.9(postcss@8.4.40)(rollup@4.20.0)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)) + version: 0.61.9(postcss@8.4.40)(rollup@4.20.0)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)) unplugin-auto-import: specifier: ^0.18.2 version: 0.18.2(@vueuse/core@10.11.0(vue@3.4.37(typescript@5.5.4)))(rollup@4.20.0) @@ -798,11 +798,11 @@ importers: specifier: ^0.27.3 version: 0.27.3(@babel/parser@7.25.3)(rollup@4.20.0)(vue@3.4.37(typescript@5.5.4)) vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vite-plugin-pages: specifier: ^0.32.3 - version: 0.32.3(@vue/compiler-sfc@3.4.37)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))(vue-router@4.4.2(vue@3.4.37(typescript@5.5.4))) + version: 0.32.3(@vue/compiler-sfc@3.4.37)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))(vue-router@4.4.2(vue@3.4.37(typescript@5.5.4))) vue: specifier: ^3.4.37 version: 3.4.37(typescript@5.5.4) @@ -856,8 +856,8 @@ importers: specifier: ^1.2.0 version: 1.2.0 vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.14.14)(terser@5.22.0) devDependencies: '@jridgewell/trace-mapping': specifier: ^0.3.25 @@ -923,8 +923,8 @@ importers: specifier: ^1.2.0 version: 1.2.0 vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vite-node: specifier: workspace:* version: link:../vite-node @@ -1080,7 +1080,7 @@ importers: version: 18.2.79 '@vitejs/plugin-basic-ssl': specifier: ^1.0.2 - version: 1.0.2(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)) + version: 1.0.2(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)) '@vitest/browser': specifier: workspace:* version: link:../../packages/browser @@ -1125,7 +1125,7 @@ importers: version: 8.5.9 '@vitejs/plugin-basic-ssl': specifier: ^1.0.2 - version: 1.0.2(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)) + version: 1.0.2(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)) '@vitest/runner': specifier: workspace:^ version: link:../../packages/runner @@ -1142,8 +1142,8 @@ importers: specifier: ^1.4.4 version: 1.4.4(@swc/core@1.4.1)(rollup@4.20.0) vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -1157,8 +1157,8 @@ importers: specifier: ^8.0.1 version: 8.0.1 vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -1251,7 +1251,7 @@ importers: version: 3.0.3 '@vitejs/plugin-vue': specifier: latest - version: 5.1.2(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))(vue@3.4.37(typescript@5.5.4)) + version: 5.1.2(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))(vue@3.4.37(typescript@5.5.4)) '@vitest/browser': specifier: workspace:* version: link:../../packages/browser @@ -1283,8 +1283,8 @@ importers: specifier: ^1.4.4 version: 1.4.4(@swc/core@1.4.1)(rollup@4.20.0) vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -1343,8 +1343,8 @@ importers: specifier: ^7.0.1 version: 7.0.1 vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vite-node: specifier: workspace:* version: link:../../packages/vite-node @@ -1404,8 +1404,8 @@ importers: specifier: workspace:* version: link:../../packages/browser vite: - specifier: ^5.3.3 - version: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + specifier: ^5.4.0 + version: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vitest: specifier: workspace:* version: link:../../packages/vitest @@ -3072,7 +3072,7 @@ packages: resolution: {integrity: sha512-m3tl+M8IO8jgiHnk+7LSTFl8axdPXloewi7iGVLdmCwf34XOzEUur0bZVewW4DUbUipFjTS2CXu27+5f/oexBA==} peerDependencies: '@babel/core': 7.x - vite: ^5.3.3 + vite: ^5.4.0 '@prefresh/babel-plugin@0.5.0': resolution: {integrity: sha512-joAwpkUDwo7ZqJnufXRGzUb+udk20RBgfA8oLPBh5aJH2LeStmV1luBfeJTztPdyCscC2j2SmZ/tVxFRMIxAEw==} @@ -3089,7 +3089,7 @@ packages: resolution: {integrity: sha512-vthWmEqu8TZFeyrBNc9YE5SiC3DVSzPgsOCp/WQ7FqdHpOIJi7Z8XvCK06rBPOtG4914S52MjG9Ls22eVAiuqQ==} peerDependencies: preact: ^10.4.0 - vite: ^5.3.3 + vite: ^5.4.0 '@puppeteer/browsers@1.4.6': resolution: {integrity: sha512-x4BEjr2SjOPowNeiguzjozQbsc6h437ovD/wu+JpaenxVLm3jkgzHY2xOslMTp50HoTvQreMjiexiGQw1sqZlQ==} @@ -3358,7 +3358,7 @@ packages: hasBin: true peerDependencies: svelte: ^3.54.0 || ^4.0.0-next.0 - vite: ^5.3.3 + vite: ^5.4.0 '@sveltejs/vite-plugin-svelte-inspector@1.0.4': resolution: {integrity: sha512-zjiuZ3yydBtwpF3bj0kQNV0YXe+iKE545QGZVTaylW3eAzFr+pJ/cwK8lZEaRp4JtaJXhD5DyWAV4AxLh6DgaQ==} @@ -3366,14 +3366,14 @@ packages: peerDependencies: '@sveltejs/vite-plugin-svelte': ^2.2.0 svelte: ^3.54.0 || ^4.0.0 - vite: ^5.3.3 + vite: ^5.4.0 '@sveltejs/vite-plugin-svelte@2.4.6': resolution: {integrity: sha512-zO79p0+DZnXPnF0ltIigWDx/ux7Ni+HRaFOw720Qeivc1azFUrJxTl0OryXVibYNx1hCboGia1NRV3x8RNv4cA==} engines: {node: ^14.18.0 || >= 16} peerDependencies: svelte: ^3.54.0 || ^4.0.0 - vite: ^5.3.3 + vite: ^5.4.0 '@swc/core-darwin-arm64@1.4.1': resolution: {integrity: sha512-ePyfx0348UbR4DOAW24TedeJbafnzha8liXFGuQ4bdXtEVXhLfPngprrxKrAddCuv42F9aTxydlF6+adD3FBhA==} @@ -3852,7 +3852,7 @@ packages: '@unocss/astro@0.61.9': resolution: {integrity: sha512-adOXz4itYHxqhvQgJHlEU58EHDTtY2qrcEPVmQVk4qI1W+ezQV6nQMQvti8mS/HbFw3MOJhIY1MlJoZK36/cyw==} peerDependencies: - vite: ^5.3.3 + vite: ^5.4.0 peerDependenciesMeta: vite: optional: true @@ -3933,7 +3933,7 @@ packages: '@unocss/vite@0.61.9': resolution: {integrity: sha512-hP/sL9rq1DvVCbSSx05m+bwYqen1nHm9tW6elKFkfV7X5jBUywu24WRq551NZI33KmgHA525ApX++DSWye+0uw==} peerDependencies: - vite: ^5.3.3 + vite: ^5.4.0 '@vite-pwa/assets-generator@0.2.4': resolution: {integrity: sha512-DXyPLPR/IpbZPSpo1amZEPghY/ziIwpTUKNaz0v1xG+ELzCXmrVQhVzEMqr2JLSqRxjc+UzKfGJA/YdUuaao3w==} @@ -3953,19 +3953,19 @@ packages: resolution: {integrity: sha512-DKHKVtpI+eA5fvObVgQ3QtTGU70CcCnedalzqmGSR050AzKZMdUzgC8KmlOneHWH8dF2hJ3wkC9+8FDVAaDRCw==} engines: {node: '>=14.6.0'} peerDependencies: - vite: ^5.3.3 + vite: ^5.4.0 '@vitejs/plugin-react@4.2.1': resolution: {integrity: sha512-oojO9IDc4nCUUi8qIR11KoQm0XFFLIwsRBwHRR4d/88IWghn1y6ckz/bJ8GHDCsYEJee8mDzqtJxh15/cisJNQ==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: - vite: ^5.3.3 + vite: ^5.4.0 '@vitejs/plugin-vue@5.1.2': resolution: {integrity: sha512-nY9IwH12qeiJqumTCLJLE7IiNx7HZ39cbHaysEUd+Myvbz9KAqd2yq+U01Kab1R/H1BmiyM2ShTYlNH32Fzo3A==} engines: {node: ^18.0.0 || >=20.0.0} peerDependencies: - vite: ^5.3.3 + vite: ^5.4.0 vue: ^3.2.25 '@vitest/browser@2.0.5': @@ -7473,10 +7473,6 @@ packages: resolution: {integrity: sha512-A0RVJrX+IUkVZbW3ClroRWurercFhieevHB38sr2+l9eUClMqome3LmEmnhlNy+5Mr2EYN6B2Kaw9wYdd+VHiw==} engines: {node: '>=4'} - postcss@8.4.39: - resolution: {integrity: sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==} - engines: {node: ^10 || ^12 || >=14} - postcss@8.4.40: resolution: {integrity: sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==} engines: {node: ^10 || ^12 || >=14} @@ -8679,7 +8675,7 @@ packages: engines: {node: '>=14'} peerDependencies: '@unocss/webpack': 0.61.9 - vite: ^5.3.3 + vite: ^5.4.0 peerDependenciesMeta: '@unocss/webpack': optional: true @@ -8817,7 +8813,7 @@ packages: '@solidjs/router': '*' '@vue/compiler-sfc': ^2.7.0 || ^3.0.0 react-router: '*' - vite: ^5.3.3 + vite: ^5.4.0 vue-router: '*' peerDependenciesMeta: '@solidjs/router': @@ -8834,7 +8830,7 @@ packages: engines: {node: '>=16.0.0'} peerDependencies: '@vite-pwa/assets-generator': ^0.2.4 - vite: ^5.3.3 + vite: ^5.4.0 workbox-build: ^7.1.0 workbox-window: ^7.1.0 peerDependenciesMeta: @@ -8845,10 +8841,10 @@ packages: resolution: {integrity: sha512-GV2SMLAibOoXe76i02AsjAg7sbm/0lngBlERvJKVN67HOrJsHcWgkt0R6sfGLDJuFkv2aBe14Zm4vJcNME+7zw==} peerDependencies: solid-js: ^1.7.2 - vite: ^5.3.3 + vite: ^5.4.0 - vite@5.3.3: - resolution: {integrity: sha512-NPQdeCU0Dv2z5fu+ULotpuq5yfCS1BzKUIPhNbP3YBfAMGJXbt2nS+sbTFu+qchaqWTD+H3JK++nRwr6XIcp6A==} + vite@5.4.0: + resolution: {integrity: sha512-5xokfMX0PIiwCMCMb9ZJcMyh5wbBun0zUzKib+L65vAZ8GY9ePZMXxFrHbr/Kyll2+LSCY7xtERPpxkBDKngwg==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -8856,6 +8852,7 @@ packages: less: '*' lightningcss: ^1.21.0 sass: '*' + sass-embedded: '*' stylus: '*' sugarss: '*' terser: ^5.4.0 @@ -8868,6 +8865,8 @@ packages: optional: true sass: optional: true + sass-embedded: + optional: true stylus: optional: true sugarss: @@ -8878,7 +8877,7 @@ packages: vitefu@0.2.4: resolution: {integrity: sha512-fanAXjSaf9xXtOOeno8wZXIhgia+CZury481LsDaV++lSvcU2R9Ch2bPh3PYFyoHW+w9LqAeYRISVQjUIew14g==} peerDependencies: - vite: ^5.3.3 + vite: ^5.4.0 peerDependenciesMeta: vite: optional: true @@ -8886,7 +8885,7 @@ packages: vitefu@0.2.5: resolution: {integrity: sha512-SgHtMLoqaeeGnd2evZ849ZbACbnwQCIwRH57t18FxcXoZop0uQu0uzlIhJBlF/eWVzuce0sHeqPcDo+evVcg8Q==} peerDependencies: - vite: ^5.3.3 + vite: ^5.4.0 peerDependenciesMeta: vite: optional: true @@ -11199,12 +11198,12 @@ snapshots: dependencies: preact: 10.21.0 - '@preact/preset-vite@2.8.2(@babel/core@7.24.5)(preact@10.21.0)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))': + '@preact/preset-vite@2.8.2(@babel/core@7.24.5)(preact@10.21.0)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))': dependencies: '@babel/core': 7.24.5 '@babel/plugin-transform-react-jsx': 7.22.15(@babel/core@7.24.5) '@babel/plugin-transform-react-jsx-development': 7.22.5(@babel/core@7.24.5) - '@prefresh/vite': 2.4.1(preact@10.21.0)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)) + '@prefresh/vite': 2.4.1(preact@10.21.0)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)) '@rollup/pluginutils': 4.2.1 babel-plugin-transform-hook-names: 1.0.2(@babel/core@7.24.5) debug: 4.3.4 @@ -11214,7 +11213,7 @@ snapshots: resolve: 1.22.8 source-map: 0.7.4 stack-trace: 1.0.0-pre2 - vite: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + vite: 5.4.0(@types/node@20.14.14)(terser@5.22.0) transitivePeerDependencies: - preact - supports-color @@ -11227,7 +11226,7 @@ snapshots: '@prefresh/utils@1.2.0': {} - '@prefresh/vite@2.4.1(preact@10.21.0)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))': + '@prefresh/vite@2.4.1(preact@10.21.0)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))': dependencies: '@babel/core': 7.24.5 '@prefresh/babel-plugin': 0.5.0 @@ -11235,7 +11234,7 @@ snapshots: '@prefresh/utils': 1.2.0 '@rollup/pluginutils': 4.2.1 preact: 10.21.0 - vite: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + vite: 5.4.0(@types/node@20.14.14)(terser@5.22.0) transitivePeerDependencies: - supports-color @@ -11520,14 +11519,14 @@ snapshots: magic-string: 0.25.9 string.prototype.matchall: 4.0.10 - '@sveltejs/adapter-auto@2.1.0(@sveltejs/kit@1.20.2(svelte@3.59.1)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)))': + '@sveltejs/adapter-auto@2.1.0(@sveltejs/kit@1.20.2(svelte@3.59.1)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)))': dependencies: - '@sveltejs/kit': 1.20.2(svelte@3.59.1)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)) + '@sveltejs/kit': 1.20.2(svelte@3.59.1)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)) import-meta-resolve: 3.0.0 - '@sveltejs/kit@1.20.2(svelte@3.59.1)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))': + '@sveltejs/kit@1.20.2(svelte@3.59.1)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))': dependencies: - '@sveltejs/vite-plugin-svelte': 2.4.6(svelte@3.59.1)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)) + '@sveltejs/vite-plugin-svelte': 2.4.6(svelte@3.59.1)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)) '@types/cookie': 0.5.1 cookie: 0.5.0 devalue: 4.3.2 @@ -11541,30 +11540,30 @@ snapshots: svelte: 3.59.1 tiny-glob: 0.2.9 undici: 5.22.1 - vite: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + vite: 5.4.0(@types/node@20.14.14)(terser@5.22.0) transitivePeerDependencies: - supports-color - '@sveltejs/vite-plugin-svelte-inspector@1.0.4(@sveltejs/vite-plugin-svelte@2.4.6(svelte@3.59.1)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)))(svelte@3.59.1)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))': + '@sveltejs/vite-plugin-svelte-inspector@1.0.4(@sveltejs/vite-plugin-svelte@2.4.6(svelte@3.59.1)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)))(svelte@3.59.1)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))': dependencies: - '@sveltejs/vite-plugin-svelte': 2.4.6(svelte@3.59.1)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)) + '@sveltejs/vite-plugin-svelte': 2.4.6(svelte@3.59.1)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)) debug: 4.3.6 svelte: 3.59.1 - vite: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + vite: 5.4.0(@types/node@20.14.14)(terser@5.22.0) transitivePeerDependencies: - supports-color - '@sveltejs/vite-plugin-svelte@2.4.6(svelte@3.59.1)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))': + '@sveltejs/vite-plugin-svelte@2.4.6(svelte@3.59.1)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))': dependencies: - '@sveltejs/vite-plugin-svelte-inspector': 1.0.4(@sveltejs/vite-plugin-svelte@2.4.6(svelte@3.59.1)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)))(svelte@3.59.1)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)) + '@sveltejs/vite-plugin-svelte-inspector': 1.0.4(@sveltejs/vite-plugin-svelte@2.4.6(svelte@3.59.1)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)))(svelte@3.59.1)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)) debug: 4.3.6 deepmerge: 4.3.1 kleur: 4.1.5 magic-string: 0.30.11 svelte: 3.59.1 svelte-hmr: 0.15.3(svelte@3.59.1) - vite: 5.3.3(@types/node@20.14.14)(terser@5.22.0) - vitefu: 0.2.5(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)) + vite: 5.4.0(@types/node@20.14.14)(terser@5.22.0) + vitefu: 0.2.5(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)) transitivePeerDependencies: - supports-color @@ -12124,13 +12123,13 @@ snapshots: '@ungap/structured-clone@1.2.0': {} - '@unocss/astro@0.61.9(rollup@4.20.0)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))': + '@unocss/astro@0.61.9(rollup@4.20.0)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))': dependencies: '@unocss/core': 0.61.9 '@unocss/reset': 0.61.9 - '@unocss/vite': 0.61.9(rollup@4.20.0)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)) + '@unocss/vite': 0.61.9(rollup@4.20.0)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)) optionalDependencies: - vite: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + vite: 5.4.0(@types/node@20.14.14)(terser@5.22.0) transitivePeerDependencies: - rollup - supports-color @@ -12267,7 +12266,7 @@ snapshots: dependencies: '@unocss/core': 0.61.9 - '@unocss/vite@0.61.9(rollup@4.20.0)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))': + '@unocss/vite@0.61.9(rollup@4.20.0)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))': dependencies: '@ampproject/remapping': 2.3.0 '@rollup/pluginutils': 5.1.0(rollup@4.20.0) @@ -12279,7 +12278,7 @@ snapshots: chokidar: 3.6.0 fast-glob: 3.3.2 magic-string: 0.30.11 - vite: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + vite: 5.4.0(@types/node@20.14.14)(terser@5.22.0) transitivePeerDependencies: - rollup - supports-color @@ -12293,30 +12292,30 @@ snapshots: sharp-ico: 0.1.5 unconfig: 0.3.11 - '@vite-pwa/vitepress@0.5.0(@vite-pwa/assets-generator@0.2.4)(vite-plugin-pwa@0.20.1(@vite-pwa/assets-generator@0.2.4)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.1.0))': + '@vite-pwa/vitepress@0.5.0(@vite-pwa/assets-generator@0.2.4)(vite-plugin-pwa@0.20.1(@vite-pwa/assets-generator@0.2.4)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.1.0))': dependencies: - vite-plugin-pwa: 0.20.1(@vite-pwa/assets-generator@0.2.4)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.1.0) + vite-plugin-pwa: 0.20.1(@vite-pwa/assets-generator@0.2.4)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.1.0) optionalDependencies: '@vite-pwa/assets-generator': 0.2.4 - '@vitejs/plugin-basic-ssl@1.0.2(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))': + '@vitejs/plugin-basic-ssl@1.0.2(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))': dependencies: - vite: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + vite: 5.4.0(@types/node@20.14.14)(terser@5.22.0) - '@vitejs/plugin-react@4.2.1(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))': + '@vitejs/plugin-react@4.2.1(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))': dependencies: '@babel/core': 7.24.4 '@babel/plugin-transform-react-jsx-self': 7.23.3(@babel/core@7.24.4) '@babel/plugin-transform-react-jsx-source': 7.23.3(@babel/core@7.24.4) '@types/babel__core': 7.20.5 react-refresh: 0.14.0 - vite: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + vite: 5.4.0(@types/node@20.14.14)(terser@5.22.0) transitivePeerDependencies: - supports-color - '@vitejs/plugin-vue@5.1.2(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))(vue@3.4.37(typescript@5.5.4))': + '@vitejs/plugin-vue@5.1.2(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))(vue@3.4.37(typescript@5.5.4))': dependencies: - vite: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + vite: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vue: 3.4.37(typescript@5.5.4) '@vitest/browser@2.0.5(playwright@1.45.3)(typescript@5.5.4)(vitest@packages+vitest)(webdriverio@8.32.2(typescript@5.5.4))': @@ -16439,12 +16438,6 @@ snapshots: cssesc: 3.0.0 util-deprecate: 1.0.2 - postcss@8.4.39: - dependencies: - nanoid: 3.3.7 - picocolors: 1.0.1 - source-map-js: 1.2.0 - postcss@8.4.40: dependencies: nanoid: 3.3.7 @@ -17792,9 +17785,9 @@ snapshots: universalify@2.0.0: {} - unocss@0.61.9(postcss@8.4.40)(rollup@4.20.0)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)): + unocss@0.61.9(postcss@8.4.40)(rollup@4.20.0)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)): dependencies: - '@unocss/astro': 0.61.9(rollup@4.20.0)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)) + '@unocss/astro': 0.61.9(rollup@4.20.0)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)) '@unocss/cli': 0.61.9(rollup@4.20.0) '@unocss/core': 0.61.9 '@unocss/extractor-arbitrary-variants': 0.61.9 @@ -17813,9 +17806,9 @@ snapshots: '@unocss/transformer-compile-class': 0.61.9 '@unocss/transformer-directives': 0.61.9 '@unocss/transformer-variant-group': 0.61.9 - '@unocss/vite': 0.61.9(rollup@4.20.0)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)) + '@unocss/vite': 0.61.9(rollup@4.20.0)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)) optionalDependencies: - vite: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + vite: 5.4.0(@types/node@20.14.14)(terser@5.22.0) transitivePeerDependencies: - postcss - rollup @@ -17977,7 +17970,7 @@ snapshots: unist-util-stringify-position: 4.0.0 vfile-message: 4.0.2 - vite-plugin-pages@0.32.3(@vue/compiler-sfc@3.4.37)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))(vue-router@4.4.2(vue@3.4.37(typescript@5.5.4))): + vite-plugin-pages@0.32.3(@vue/compiler-sfc@3.4.37)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))(vue-router@4.4.2(vue@3.4.37(typescript@5.5.4))): dependencies: '@types/debug': 4.1.12 debug: 4.3.6 @@ -17987,7 +17980,7 @@ snapshots: json5: 2.2.3 local-pkg: 0.5.0 picocolors: 1.0.1 - vite: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + vite: 5.4.0(@types/node@20.14.14)(terser@5.22.0) yaml: 2.4.5 optionalDependencies: '@vue/compiler-sfc': 3.4.37 @@ -17995,12 +17988,12 @@ snapshots: transitivePeerDependencies: - supports-color - vite-plugin-pwa@0.20.1(@vite-pwa/assets-generator@0.2.4)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.1.0): + vite-plugin-pwa@0.20.1(@vite-pwa/assets-generator@0.2.4)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.1.0): dependencies: debug: 4.3.6 pretty-bytes: 6.1.1 tinyglobby: 0.2.0 - vite: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + vite: 5.4.0(@types/node@20.14.14)(terser@5.22.0) workbox-build: 7.1.0(@types/babel__core@7.20.5) workbox-window: 7.1.0 optionalDependencies: @@ -18008,7 +18001,7 @@ snapshots: transitivePeerDependencies: - supports-color - vite-plugin-solid@2.7.2(solid-js@1.8.3)(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)): + vite-plugin-solid@2.7.2(solid-js@1.8.3)(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)): dependencies: '@babel/core': 7.23.3 '@babel/preset-typescript': 7.23.2(@babel/core@7.23.3) @@ -18017,38 +18010,38 @@ snapshots: merge-anything: 5.1.7 solid-js: 1.8.3 solid-refresh: 0.5.3(solid-js@1.8.3) - vite: 5.3.3(@types/node@20.14.14)(terser@5.22.0) - vitefu: 0.2.4(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)) + vite: 5.4.0(@types/node@20.14.14)(terser@5.22.0) + vitefu: 0.2.4(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)) transitivePeerDependencies: - supports-color - vite@5.3.3(@types/node@20.11.5)(terser@5.22.0): + vite@5.4.0(@types/node@20.11.5)(terser@5.22.0): dependencies: esbuild: 0.21.5 - postcss: 8.4.39 + postcss: 8.4.40 rollup: 4.20.0 optionalDependencies: '@types/node': 20.11.5 fsevents: 2.3.3 terser: 5.22.0 - vite@5.3.3(@types/node@20.14.14)(terser@5.22.0): + vite@5.4.0(@types/node@20.14.14)(terser@5.22.0): dependencies: esbuild: 0.21.5 - postcss: 8.4.39 + postcss: 8.4.40 rollup: 4.20.0 optionalDependencies: '@types/node': 20.14.14 fsevents: 2.3.3 terser: 5.22.0 - vitefu@0.2.4(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)): + vitefu@0.2.4(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)): optionalDependencies: - vite: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + vite: 5.4.0(@types/node@20.14.14)(terser@5.22.0) - vitefu@0.2.5(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0)): + vitefu@0.2.5(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0)): optionalDependencies: - vite: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + vite: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vitepress-plugin-tabs@0.5.0(vitepress@1.3.1(@algolia/client-search@4.20.0)(@types/node@20.14.14)(@types/react@18.2.79)(postcss@8.4.40)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.9.0)(terser@5.22.0)(typescript@5.5.4))(vue@3.4.37(typescript@5.5.4)): dependencies: @@ -18062,7 +18055,7 @@ snapshots: '@shikijs/core': 1.10.3 '@shikijs/transformers': 1.10.3 '@types/markdown-it': 14.1.1 - '@vitejs/plugin-vue': 5.1.2(vite@5.3.3(@types/node@20.14.14)(terser@5.22.0))(vue@3.4.37(typescript@5.5.4)) + '@vitejs/plugin-vue': 5.1.2(vite@5.4.0(@types/node@20.14.14)(terser@5.22.0))(vue@3.4.37(typescript@5.5.4)) '@vue/devtools-api': 7.3.6 '@vue/shared': 3.4.31 '@vueuse/core': 10.11.0(vue@3.4.37(typescript@5.5.4)) @@ -18071,7 +18064,7 @@ snapshots: mark.js: 8.11.1 minisearch: 7.0.0 shiki: 1.10.3 - vite: 5.3.3(@types/node@20.14.14)(terser@5.22.0) + vite: 5.4.0(@types/node@20.14.14)(terser@5.22.0) vue: 3.4.37(typescript@5.5.4) optionalDependencies: postcss: 8.4.40 @@ -18094,6 +18087,7 @@ snapshots: - react - react-dom - sass + - sass-embedded - search-insights - sortablejs - stylus diff --git a/test/config/test/exec-args.test.ts b/test/config/test/exec-args.test.ts index add2796a5da3..fa79b75b9add 100644 --- a/test/config/test/exec-args.test.ts +++ b/test/config/test/exec-args.test.ts @@ -10,6 +10,10 @@ test.each([ const root = './fixtures/exec-args-fixtures' const fileToTest = `${pool}.test.ts` + if (process.version === 'v20.15.0' && pool !== 'forks') { + return + } + const vitest = await runVitest({ root, include: [fileToTest], diff --git a/test/coverage-test/fixtures/src/pre-bundle/bundle.js b/test/coverage-test/fixtures/src/pre-bundle/bundle.js new file mode 100644 index 000000000000..e946da37baf8 --- /dev/null +++ b/test/coverage-test/fixtures/src/pre-bundle/bundle.js @@ -0,0 +1,30 @@ +function covered$1() { + return "First"; +} + +function uncovered$1() { + return "Uncovered"; +} + +var first = /*#__PURE__*/Object.freeze({ + __proto__: null, + covered: covered$1, + uncovered: uncovered$1 +}); + +function covered() { + return "Second"; +} + +function uncovered() { + return "Uncovered"; +} + +var second = /*#__PURE__*/Object.freeze({ + __proto__: null, + covered: covered, + uncovered: uncovered +}); + +export { first, second }; +//# sourceMappingURL=bundle.js.map diff --git a/test/coverage-test/fixtures/src/pre-bundle/bundle.js.map b/test/coverage-test/fixtures/src/pre-bundle/bundle.js.map new file mode 100644 index 000000000000..13d34ae1da4f --- /dev/null +++ b/test/coverage-test/fixtures/src/pre-bundle/bundle.js.map @@ -0,0 +1,17 @@ +{ + "version": 3, + "file": "bundle.js", + "sources": [ + "./first.ts", + "./second.ts" + ], + "sourcesContent": [ + "export function covered() {\n return \"First\";\n}\n\nexport function uncovered() {\n return \"Uncovered\";\n}\n", + "export function covered() {\n return \"Second\";\n}\n\nexport function uncovered() {\n return \"Uncovered\";\n}\n" + ], + "names": [ + "covered", + "uncovered" + ], + "mappings": "AAAO,SAASA,SAAO,GAAG;AAC1B,EAAE,OAAO,OAAO,CAAC;AACjB,CAAC;AACD;AACO,SAASC,WAAS,GAAG;AAC5B,EAAE,OAAO,WAAW,CAAC;AACrB;;;;;;;;ACNO,SAAS,OAAO,GAAG;AAC1B,EAAE,OAAO,QAAQ,CAAC;AAClB,CAAC;AACD;AACO,SAAS,SAAS,GAAG;AAC5B,EAAE,OAAO,WAAW,CAAC;AACrB;;;;;;;;;;" +} diff --git a/test/coverage-test/fixtures/src/pre-bundle/bundle.ts b/test/coverage-test/fixtures/src/pre-bundle/bundle.ts new file mode 100644 index 000000000000..181090555ccf --- /dev/null +++ b/test/coverage-test/fixtures/src/pre-bundle/bundle.ts @@ -0,0 +1,2 @@ +export * as first from "./first"; +export * as second from "./second"; diff --git a/test/coverage-test/fixtures/src/pre-bundle/first.ts b/test/coverage-test/fixtures/src/pre-bundle/first.ts new file mode 100644 index 000000000000..93478421809b --- /dev/null +++ b/test/coverage-test/fixtures/src/pre-bundle/first.ts @@ -0,0 +1,7 @@ +export function covered() { + return "First"; +} + +export function uncovered() { + return "Uncovered"; +} diff --git a/test/coverage-test/fixtures/src/pre-bundle/second.ts b/test/coverage-test/fixtures/src/pre-bundle/second.ts new file mode 100644 index 000000000000..20e24039b3fc --- /dev/null +++ b/test/coverage-test/fixtures/src/pre-bundle/second.ts @@ -0,0 +1,7 @@ +export function covered() { + return "Second"; +} + +export function uncovered() { + return "Uncovered"; +} diff --git a/test/coverage-test/test/__snapshots__/bundled-istanbul.snapshot.json b/test/coverage-test/test/__snapshots__/bundled-istanbul.snapshot.json new file mode 100644 index 000000000000..42389d735580 --- /dev/null +++ b/test/coverage-test/test/__snapshots__/bundled-istanbul.snapshot.json @@ -0,0 +1,168 @@ +{ + "/fixtures/src/pre-bundle/first.ts": { + "path": "/fixtures/src/pre-bundle/first.ts", + "statementMap": { + "0": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "1": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + "fnMap": { + "0": { + "name": "covered$1", + "decl": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "1": { + "name": "uncovered$1", + "decl": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 25 + } + }, + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 7, + "column": null + } + } + } + }, + "branchMap": {}, + "s": { + "0": 1, + "1": 0 + }, + "f": { + "0": 1, + "1": 0 + }, + "b": {} + }, + "/fixtures/src/pre-bundle/second.ts": { + "path": "/fixtures/src/pre-bundle/second.ts", + "statementMap": { + "0": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "1": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + "fnMap": { + "0": { + "name": "covered", + "decl": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "1": { + "name": "uncovered", + "decl": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 25 + } + }, + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 7, + "column": null + } + } + } + }, + "branchMap": {}, + "s": { + "0": 1, + "1": 0 + }, + "f": { + "0": 1, + "1": 0 + }, + "b": {} + } +} \ No newline at end of file diff --git a/test/coverage-test/test/__snapshots__/bundled-v8.snapshot.json b/test/coverage-test/test/__snapshots__/bundled-v8.snapshot.json new file mode 100644 index 000000000000..5aa335888476 --- /dev/null +++ b/test/coverage-test/test/__snapshots__/bundled-v8.snapshot.json @@ -0,0 +1,346 @@ +{ + "/fixtures/src/pre-bundle/first.ts": { + "path": "/fixtures/src/pre-bundle/first.ts", + "all": false, + "statementMap": { + "0": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "1": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "2": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "3": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 0 + } + }, + "4": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 29 + } + }, + "5": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 21 + } + }, + "6": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + "s": { + "0": 1, + "1": 1, + "2": 1, + "3": 1, + "4": 1, + "5": 0, + "6": 0 + }, + "branchMap": { + "0": { + "type": "branch", + "line": 1, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "locations": [ + { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + } + ] + } + }, + "b": { + "0": [ + 1 + ] + }, + "fnMap": { + "0": { + "name": "covered$1", + "decl": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "line": 1 + }, + "1": { + "name": "uncovered$1", + "decl": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "line": 5 + } + }, + "f": { + "0": 1, + "1": 0 + } + }, + "/fixtures/src/pre-bundle/second.ts": { + "path": "/fixtures/src/pre-bundle/second.ts", + "all": false, + "statementMap": { + "0": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "1": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "2": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "3": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 0 + } + }, + "4": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 29 + } + }, + "5": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 21 + } + }, + "6": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + "s": { + "0": 1, + "1": 1, + "2": 1, + "3": 1, + "4": 1, + "5": 0, + "6": 0 + }, + "branchMap": { + "0": { + "type": "branch", + "line": 1, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "locations": [ + { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + } + ] + } + }, + "b": { + "0": [ + 1 + ] + }, + "fnMap": { + "0": { + "name": "covered", + "decl": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "line": 1 + }, + "1": { + "name": "uncovered", + "decl": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "line": 5 + } + }, + "f": { + "0": 1, + "1": 0 + } + } +} \ No newline at end of file diff --git a/test/coverage-test/test/bundled-sources.test.ts b/test/coverage-test/test/bundled-sources.test.ts new file mode 100644 index 000000000000..d90eb6516966 --- /dev/null +++ b/test/coverage-test/test/bundled-sources.test.ts @@ -0,0 +1,36 @@ +import libCoverage from 'istanbul-lib-coverage' +import { expect } from 'vitest' +import { coverageTest, isV8Provider, normalizeURL, readCoverageJson, runVitest, test } from '../utils.js' +import * as transpiled from '../fixtures/src/pre-bundle/bundle.js' + +test('bundled code with source maps to originals', async () => { + await runVitest({ + include: [normalizeURL(import.meta.url)], + coverage: { + include: ['fixtures/src/**'], + reporter: 'json', + all: false, + }, + }) + + const coverageJson = await readCoverageJson() + const coverageMap = libCoverage.createCoverageMap(coverageJson) + const files = coverageMap.files() + + expect(files).toContain('/fixtures/src/pre-bundle/first.ts') + expect(files).toContain('/fixtures/src/pre-bundle/second.ts') + expect(files.find(file => file.includes('bundle.js'))).toBeFalsy() + expect(files.find(file => file.includes('bundle.js.map'))).toBeFalsy() + expect(files.find(file => file.includes('bundle.ts'))).toBeFalsy() + expect(files.find(file => file.includes('bundle.d.ts'))).toBeFalsy() + + expect(JSON.stringify(coverageJson, null, 2)).toMatchFileSnapshot(`__snapshots__/bundled-${isV8Provider() ? 'v8' : 'istanbul'}.snapshot.json`) +}) + +coverageTest('run bundled sources', () => { + expect(transpiled.first.covered).toBeTypeOf('function') + expect(transpiled.first.covered()).toBe('First') + + expect(transpiled.second.covered).toBeTypeOf('function') + expect(transpiled.second.covered()).toBe('Second') +}) diff --git a/test/coverage-test/vitest.workspace.custom.ts b/test/coverage-test/vitest.workspace.custom.ts index c80771749b28..0e434e19b21e 100644 --- a/test/coverage-test/vitest.workspace.custom.ts +++ b/test/coverage-test/vitest.workspace.custom.ts @@ -89,6 +89,7 @@ export default defineWorkspace([ enabled: true, include: ['**/test/*.test-d.ts'], tsconfig: '../../tsconfig.check.json', + ignoreSourceErrors: true, }, }, },