Skip to content

Commit 1191444

Browse files
authored
chore(deps): bump vitest to v3 (#6842)
1 parent 0dcd5ea commit 1191444

File tree

9 files changed

+480
-277
lines changed

9 files changed

+480
-277
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"test": "npm run test:ut",
2020
"test:rspack": "cd tests && pnpm run test:rspack",
2121
"test:jest": "cd tests && pnpm run test:ut",
22-
"test:vitest": "node scripts/vitest-config/vitestRunAll.js",
22+
"test:vitest": "cross-env VITE_CJS_IGNORE_WARNING=true node scripts/vitest-config/vitestRunAll.js",
2323
"test:ut": "pnpm run test:jest && pnpm run test:vitest",
2424
"test:ut:update": "pnpm run test:jest -u && pnpm run test:vitest -u",
2525
"test:e2e": "cd tests && npm run test",
@@ -75,7 +75,7 @@
7575
"@scripts/build": "workspace:*",
7676
"@types/react": "^18.3.11",
7777
"@types/react-dom": "^18.3.1",
78-
"@vitest/ui": "^0.34.0",
78+
"@vitest/ui": "^3.0.0",
7979
"antd": "^5",
8080
"check-dependency-version-consistency": "4.1.1",
8181
"cross-env": "^7.0.3",
@@ -84,7 +84,7 @@
8484
"lint-staged": "~13.3.0",
8585
"nx": "^17.0.1",
8686
"rimraf": "^6.0.1",
87-
"vitest": "0.34.6"
87+
"vitest": "^3.0.0"
8888
},
8989
"pnpm": {
9090
"peerDependencyRules": {

packages/cli/uni-builder/src/shared/parseCommonConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export async function parseCommonConfig(
210210
}
211211

212212
if (disableCssExtract) {
213-
output.injectStyles = disableCssExtract;
213+
output.injectStyles ??= disableCssExtract;
214214
}
215215

216216
if (enableInlineStyles) {

packages/cli/uni-builder/tests/__snapshots__/default.test.ts.snap

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -944,12 +944,12 @@ exports[`uni-builder rspack > should generator rspack config correctly 1`] = `
944944
DefinePlugin {
945945
"_args": [
946946
{
947-
"import.meta.env.ASSET_PREFIX": "\\"\\"",
947+
"import.meta.env.ASSET_PREFIX": """",
948948
"import.meta.env.BASE_URL": "\\"/\\"",
949949
"import.meta.env.DEV": true,
950-
"import.meta.env.MODE": "\\"development\\"",
950+
"import.meta.env.MODE": ""development"",
951951
"import.meta.env.PROD": false,
952-
"process.env.ASSET_PREFIX": "\\"\\"",
952+
"process.env.ASSET_PREFIX": """",
953953
"process.env.BASE_URL": "\\"/\\"",
954954
},
955955
],
@@ -1773,12 +1773,12 @@ exports[`uni-builder rspack > should generator rspack config correctly when node
17731773
DefinePlugin {
17741774
"_args": [
17751775
{
1776-
"import.meta.env.ASSET_PREFIX": "\\"\\"",
1776+
"import.meta.env.ASSET_PREFIX": """",
17771777
"import.meta.env.BASE_URL": "\\"/\\"",
17781778
"import.meta.env.DEV": false,
1779-
"import.meta.env.MODE": "\\"production\\"",
1779+
"import.meta.env.MODE": ""production"",
17801780
"import.meta.env.PROD": true,
1781-
"process.env.ASSET_PREFIX": "\\"\\"",
1781+
"process.env.ASSET_PREFIX": """",
17821782
"process.env.BASE_URL": "\\"/\\"",
17831783
},
17841784
],
@@ -2827,12 +2827,12 @@ exports[`uni-builder rspack > should generator rspack config correctly when prod
28272827
DefinePlugin {
28282828
"_args": [
28292829
{
2830-
"import.meta.env.ASSET_PREFIX": "\\"\\"",
2830+
"import.meta.env.ASSET_PREFIX": """",
28312831
"import.meta.env.BASE_URL": "\\"/\\"",
28322832
"import.meta.env.DEV": false,
2833-
"import.meta.env.MODE": "\\"production\\"",
2833+
"import.meta.env.MODE": ""production"",
28342834
"import.meta.env.PROD": true,
2835-
"process.env.ASSET_PREFIX": "\\"\\"",
2835+
"process.env.ASSET_PREFIX": """",
28362836
"process.env.BASE_URL": "\\"/\\"",
28372837
},
28382838
],
@@ -3596,12 +3596,12 @@ exports[`uni-builder rspack > should generator rspack config correctly when serv
35963596
DefinePlugin {
35973597
"_args": [
35983598
{
3599-
"import.meta.env.ASSET_PREFIX": "\\"\\"",
3599+
"import.meta.env.ASSET_PREFIX": """",
36003600
"import.meta.env.BASE_URL": "\\"/\\"",
36013601
"import.meta.env.DEV": false,
3602-
"import.meta.env.MODE": "\\"production\\"",
3602+
"import.meta.env.MODE": ""production"",
36033603
"import.meta.env.PROD": true,
3604-
"process.env.ASSET_PREFIX": "\\"\\"",
3604+
"process.env.ASSET_PREFIX": """",
36053605
"process.env.BASE_URL": "\\"/\\"",
36063606
},
36073607
],
@@ -4823,12 +4823,12 @@ exports[`uni-builder webpack > should generator webpack config correctly 1`] = `
48234823
},
48244824
DefinePlugin {
48254825
"definitions": {
4826-
"import.meta.env.ASSET_PREFIX": "\\"\\"",
4826+
"import.meta.env.ASSET_PREFIX": """",
48274827
"import.meta.env.BASE_URL": "\\"/\\"",
48284828
"import.meta.env.DEV": true,
4829-
"import.meta.env.MODE": "\\"development\\"",
4829+
"import.meta.env.MODE": ""development"",
48304830
"import.meta.env.PROD": false,
4831-
"process.env.ASSET_PREFIX": "\\"\\"",
4831+
"process.env.ASSET_PREFIX": """",
48324832
"process.env.BASE_URL": "\\"/\\"",
48334833
},
48344834
},
@@ -6194,12 +6194,12 @@ exports[`uni-builder webpack > should generator webpack config correctly when pr
61946194
},
61956195
DefinePlugin {
61966196
"definitions": {
6197-
"import.meta.env.ASSET_PREFIX": "\\"\\"",
6197+
"import.meta.env.ASSET_PREFIX": """",
61986198
"import.meta.env.BASE_URL": "\\"/\\"",
61996199
"import.meta.env.DEV": false,
6200-
"import.meta.env.MODE": "\\"production\\"",
6200+
"import.meta.env.MODE": ""production"",
62016201
"import.meta.env.PROD": true,
6202-
"process.env.ASSET_PREFIX": "\\"\\"",
6202+
"process.env.ASSET_PREFIX": """",
62036203
"process.env.BASE_URL": "\\"/\\"",
62046204
},
62056205
},

packages/cli/uni-builder/tests/__snapshots__/environment.test.ts.snap

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -945,12 +945,12 @@ exports[`uni-builder environment compat > should generator environment config co
945945
DefinePlugin {
946946
"_args": [
947947
{
948-
"import.meta.env.ASSET_PREFIX": "\\"\\"",
948+
"import.meta.env.ASSET_PREFIX": """",
949949
"import.meta.env.BASE_URL": "\\"/\\"",
950950
"import.meta.env.DEV": true,
951-
"import.meta.env.MODE": "\\"development\\"",
951+
"import.meta.env.MODE": ""development"",
952952
"import.meta.env.PROD": false,
953-
"process.env.ASSET_PREFIX": "\\"\\"",
953+
"process.env.ASSET_PREFIX": """",
954954
"process.env.BASE_URL": "\\"/\\"",
955955
},
956956
],
@@ -1691,12 +1691,12 @@ exports[`uni-builder environment compat > should generator environment config co
16911691
DefinePlugin {
16921692
"_args": [
16931693
{
1694-
"import.meta.env.ASSET_PREFIX": "\\"\\"",
1694+
"import.meta.env.ASSET_PREFIX": """",
16951695
"import.meta.env.BASE_URL": "\\"/\\"",
16961696
"import.meta.env.DEV": true,
1697-
"import.meta.env.MODE": "\\"development\\"",
1697+
"import.meta.env.MODE": ""development"",
16981698
"import.meta.env.PROD": false,
1699-
"process.env.ASSET_PREFIX": "\\"\\"",
1699+
"process.env.ASSET_PREFIX": """",
17001700
"process.env.BASE_URL": "\\"/\\"",
17011701
},
17021702
],
@@ -2419,12 +2419,12 @@ exports[`uni-builder environment compat > should generator environment config co
24192419
DefinePlugin {
24202420
"_args": [
24212421
{
2422-
"import.meta.env.ASSET_PREFIX": "\\"\\"",
2422+
"import.meta.env.ASSET_PREFIX": """",
24232423
"import.meta.env.BASE_URL": "\\"/\\"",
24242424
"import.meta.env.DEV": true,
2425-
"import.meta.env.MODE": "\\"development\\"",
2425+
"import.meta.env.MODE": ""development"",
24262426
"import.meta.env.PROD": false,
2427-
"process.env.ASSET_PREFIX": "\\"\\"",
2427+
"process.env.ASSET_PREFIX": """",
24282428
"process.env.BASE_URL": "\\"/\\"",
24292429
},
24302430
],

packages/cli/uni-builder/tests/__snapshots__/globalVars.test.ts.snap

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ exports[`plugin-global-vars > 'globalVars function' 1`] = `
44
[
55
DefinePlugin {
66
"definitions": {
7-
"import.meta.env.ASSET_PREFIX": "\\"\\"",
7+
"import.meta.env.ASSET_PREFIX": """",
88
"import.meta.env.BASE_URL": "\\"/\\"",
99
"import.meta.env.DEV": false,
10-
"import.meta.env.MODE": "\\"none\\"",
10+
"import.meta.env.MODE": ""none"",
1111
"import.meta.env.PROD": false,
12-
"process.env.ASSET_PREFIX": "\\"\\"",
12+
"process.env.ASSET_PREFIX": """",
1313
"process.env.BASE_URL": "\\"/\\"",
1414
},
1515
},
1616
DefinePlugin {
1717
"definitions": {
18-
"ENV": "\\"test\\"",
19-
"TARGET": "\\"web\\"",
18+
"ENV": ""test"",
19+
"TARGET": ""web"",
2020
},
2121
},
2222
]
@@ -26,20 +26,20 @@ exports[`plugin-global-vars > 'globalVars' 1`] = `
2626
[
2727
DefinePlugin {
2828
"definitions": {
29-
"import.meta.env.ASSET_PREFIX": "\\"\\"",
29+
"import.meta.env.ASSET_PREFIX": """",
3030
"import.meta.env.BASE_URL": "\\"/\\"",
3131
"import.meta.env.DEV": false,
32-
"import.meta.env.MODE": "\\"none\\"",
32+
"import.meta.env.MODE": ""none"",
3333
"import.meta.env.PROD": false,
34-
"process.env.ASSET_PREFIX": "\\"\\"",
34+
"process.env.ASSET_PREFIX": """",
3535
"process.env.BASE_URL": "\\"/\\"",
3636
},
3737
},
3838
DefinePlugin {
3939
"definitions": {
40-
"import.meta.bar": "{\\"a\\":\\"bar\\",\\"b\\":false,\\"c\\":{\\"d\\":42}}",
41-
"process.env.foo": "\\"foo\\"",
42-
"window.baz": "[null,\\"baz\\"]",
40+
"import.meta.bar": "{"a":"bar","b":false,"c":{"d":42}}",
41+
"process.env.foo": ""foo"",
42+
"window.baz": "[null,"baz"]",
4343
},
4444
},
4545
]

packages/cli/uni-builder/tests/__snapshots__/minimize.test.ts.snap

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ exports[`html minify > should not apply html minify in production when disableMi
8585
},
8686
DefinePlugin {
8787
"definitions": {
88-
"import.meta.env.ASSET_PREFIX": "\\"\\"",
88+
"import.meta.env.ASSET_PREFIX": """",
8989
"import.meta.env.BASE_URL": "\\"/\\"",
9090
"import.meta.env.DEV": false,
91-
"import.meta.env.MODE": "\\"production\\"",
91+
"import.meta.env.MODE": ""production"",
9292
"import.meta.env.PROD": true,
93-
"process.env.ASSET_PREFIX": "\\"\\"",
93+
"process.env.ASSET_PREFIX": """",
9494
"process.env.BASE_URL": "\\"/\\"",
9595
},
9696
},
@@ -218,12 +218,12 @@ exports[`html minify > should not apply html minify when htmlPlugin.minify false
218218
},
219219
DefinePlugin {
220220
"definitions": {
221-
"import.meta.env.ASSET_PREFIX": "\\"\\"",
221+
"import.meta.env.ASSET_PREFIX": """",
222222
"import.meta.env.BASE_URL": "\\"/\\"",
223223
"import.meta.env.DEV": false,
224-
"import.meta.env.MODE": "\\"production\\"",
224+
"import.meta.env.MODE": ""production"",
225225
"import.meta.env.PROD": true,
226-
"process.env.ASSET_PREFIX": "\\"\\"",
226+
"process.env.ASSET_PREFIX": """",
227227
"process.env.BASE_URL": "\\"/\\"",
228228
},
229229
},
@@ -288,12 +288,12 @@ exports[`html minify > should not apply html plugin when htmlPlugin false 1`] =
288288
},
289289
DefinePlugin {
290290
"definitions": {
291-
"import.meta.env.ASSET_PREFIX": "\\"\\"",
291+
"import.meta.env.ASSET_PREFIX": """",
292292
"import.meta.env.BASE_URL": "\\"/\\"",
293293
"import.meta.env.DEV": false,
294-
"import.meta.env.MODE": "\\"production\\"",
294+
"import.meta.env.MODE": ""production"",
295295
"import.meta.env.PROD": true,
296-
"process.env.ASSET_PREFIX": "\\"\\"",
296+
"process.env.ASSET_PREFIX": """",
297297
"process.env.BASE_URL": "\\"/\\"",
298298
},
299299
},

packages/cli/uni-builder/tests/loaders/__snapshots__/rsc-ssr-loader.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ exports[`rscSsrLoader > should transform server module correctly 1`] = `
5050
'use server';
5151
5252
export const foo = () => {
53-
throw new Error(\\"Server actions must not be called during server-side rendering.\\")
53+
throw new Error("Server actions must not be called during server-side rendering.")
5454
}
5555
export const bar = () => {
56-
throw new Error(\\"Server actions must not be called during server-side rendering.\\")
56+
throw new Error("Server actions must not be called during server-side rendering.")
5757
}
5858
export const b = () => {
59-
throw new Error(\\"Server actions must not be called during server-side rendering.\\")
59+
throw new Error("Server actions must not be called during server-side rendering.")
6060
}
61-
export default () => {throw new Error(\\"Server actions must not be called during server-side rendering.\\")}"
61+
export default () => {throw new Error("Server actions must not be called during server-side rendering.")}"
6262
`;

packages/cli/uni-builder/tests/parseConfig.test.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,11 @@ describe('parseCommonConfig', () => {
333333
});
334334

335335
const injectStylesCases: [UniBuilderConfig['output'], OutputConfig][] = [
336-
[{}, { injectStyles: false }],
336+
[{}, { injectStyles: undefined }],
337337
[{ injectStyles: true }, { injectStyles: true }],
338338
[{ injectStyles: false }, { injectStyles: false }],
339339
[{ disableCssExtract: true }, { injectStyles: true }],
340-
[{ disableCssExtract: false }, { injectStyles: false }],
340+
[{ disableCssExtract: false }, { injectStyles: undefined }],
341341
[{ disableCssExtract: true, injectStyles: true }, { injectStyles: true }],
342342
[{ disableCssExtract: false, injectStyles: true }, { injectStyles: true }],
343343
[{ disableCssExtract: true, injectStyles: false }, { injectStyles: false }],
@@ -350,12 +350,15 @@ describe('parseCommonConfig', () => {
350350
{ injectStyles: false },
351351
],
352352
];
353-
test('output.injectStyles', () => {
353+
describe('output.injectStyles', () => {
354354
for (const [config, output] of injectStylesCases) {
355-
test(`${JSON.stringify(config)} => ${JSON.stringify(output)}`, async () => {
355+
test(`${JSON.stringify(config)} => ${JSON.stringify(
356+
output,
357+
)}`, async () => {
356358
expect(
357-
(await parseCommonConfig({ output: config })).rsbuildConfig.output,
358-
).toEqual(output);
359+
(await parseCommonConfig({ output: config })).rsbuildConfig.output
360+
?.injectStyles,
361+
).toEqual(output.injectStyles);
359362
});
360363
}
361364
});

0 commit comments

Comments
 (0)