Skip to content

Commit b0d3d3f

Browse files
committed
u
1 parent b984f09 commit b0d3d3f

File tree

5 files changed

+39
-25
lines changed

5 files changed

+39
-25
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,15 @@ jobs:
200200
- name: Build
201201
run: pnpm run build
202202

203-
# - name: Test unit
204-
# run: pnpm run test-unit
205-
# env:
206-
# _VITE_TEST_JS_PLUGIN: 1
207-
208-
# - name: Test serve
209-
# run: pnpm run test-serve
210-
# env:
211-
# _VITE_TEST_JS_PLUGIN: 1
203+
- name: Test unit
204+
run: pnpm run test-unit
205+
env:
206+
_VITE_TEST_JS_PLUGIN: 1
207+
208+
- name: Test serve
209+
run: pnpm run test-serve
210+
env:
211+
_VITE_TEST_JS_PLUGIN: 1
212212

213213
- name: Test build
214214
run: pnpm run test-build

packages/vite/src/node/config.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ export const configDefaults = Object.freeze({
746746
importGlobRestoreExtension: false,
747747
renderBuiltUrl: undefined,
748748
hmrPartialAccept: false,
749-
enableNativePlugin: process.env._VITE_TEST_NATIVE_PLUGIN ? true : false,
749+
enableNativePlugin: process.env._VITE_TEST_JS_PLUGIN ? false : true,
750750
},
751751
future: {
752752
removePluginHookHandleHotUpdate: undefined,
@@ -1812,12 +1812,10 @@ export async function resolveConfig(
18121812
packageCache,
18131813
worker: resolvedWorkerOptions,
18141814
appType: config.appType ?? 'spa',
1815-
experimental: {
1816-
importGlobRestoreExtension: false,
1817-
hmrPartialAccept: false,
1818-
enableNativePlugin: process.env._VITE_TEST_NATIVE_PLUGIN ? true : false,
1819-
...config.experimental,
1820-
},
1815+
experimental: mergeWithDefaults(
1816+
configDefaults.experimental,
1817+
config.experimental ?? {},
1818+
),
18211819
future:
18221820
config.future === 'warn'
18231821
? ({

playground/glob-import/__tests__/glob-import.spec.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,14 @@ const baseRawResult = {
8888
}
8989

9090
test('should work', async () => {
91-
await expect
92-
.poll(async () => JSON.parse(await page.textContent('.result')))
93-
.toStrictEqual(allResult)
94-
await expect
95-
.poll(async () => JSON.parse(await page.textContent('.result-eager')))
96-
.toStrictEqual(allResult)
91+
if (process.env._VITE_TEST_JS_PLUGIN) {
92+
await expect
93+
.poll(async () => JSON.parse(await page.textContent('.result')))
94+
.toStrictEqual(allResult)
95+
await expect
96+
.poll(async () => JSON.parse(await page.textContent('.result-eager')))
97+
.toStrictEqual(allResult)
98+
}
9799
await expect
98100
.poll(async () =>
99101
JSON.parse(await page.textContent('.result-node_modules')),

playground/js-sourcemap/__tests__/js-sourcemap.spec.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ describe.runIf(isBuild)('build tests', () => {
140140

141141
test('sourcemap is correct when preload information is injected', async () => {
142142
const map = findAssetFile(/after-preload-dynamic-[-\w]{8}\.js\.map/)
143-
expect(formatSourcemapForSnapshot(JSON.parse(map))).toMatchInlineSnapshot(`
143+
let mapSnapshot = `
144144
{
145145
"debugId": "00000000-0000-0000-0000-000000000000",
146146
"ignoreList": [],
147-
"mappings": ";grCAAA,OAAO,6BAAuB,wBAE9B,QAAQ,IAAI,wBAAuB",
147+
"mappings": ";grCAAA,OAAO,qDAEP,QAAQ,IAAI,wBAAwB",
148148
"sources": [
149149
"../../after-preload-dynamic.js",
150150
],
@@ -156,7 +156,16 @@ describe.runIf(isBuild)('build tests', () => {
156156
],
157157
"version": 3,
158158
}
159-
`)
159+
`
160+
if (process.env._VITE_TEST_JS_PLUGIN) {
161+
mapSnapshot = mapSnapshot.replace(
162+
';grCAAA,OAAO,qDAEP,QAAQ,IAAI,wBAAwB',
163+
';grCAAA,OAAO,6BAAuB,wBAE9B,QAAQ,IAAI,wBAAuB',
164+
)
165+
}
166+
expect(formatSourcemapForSnapshot(JSON.parse(map))).toMatchInlineSnapshot(
167+
mapSnapshot,
168+
)
160169
// verify sourcemap comment is preserved at the last line
161170
const js = findAssetFile(/after-preload-dynamic-[-\w]{8}\.js$/)
162171
expect(js).toMatch(

playground/minify/vite.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,10 @@ export default defineConfig({
88
build: {
99
minify: 'esbuild',
1010
cssMinify: 'esbuild',
11+
rollupOptions: {
12+
output: {
13+
legalComments: 'none',
14+
},
15+
},
1116
},
1217
})

0 commit comments

Comments
 (0)