Skip to content

Commit de15642

Browse files
committed
fix: ut
1 parent 6fd3b17 commit de15642

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+179
-564
lines changed

packages/compat/plugin-webpack-swc/tests/plugin.test.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('plugin-webpack-swc', () => {
2020
it('should set swc-loader', async () => {
2121
const rsbuild = await createStubRsbuild({
2222
plugins: [pluginSwc()],
23-
rsbuildConfig: {
23+
config: {
2424
provider: webpackProvider,
2525
},
2626
});
@@ -32,7 +32,7 @@ describe('plugin-webpack-swc', () => {
3232
it('should apply multiple environment configs correctly', async () => {
3333
const rsbuild = await createStubRsbuild({
3434
plugins: [pluginSwc()],
35-
rsbuildConfig: {
35+
config: {
3636
provider: webpackProvider,
3737
environments: {
3838
web: {
@@ -67,7 +67,7 @@ describe('plugin-webpack-swc', () => {
6767
process.env.NODE_ENV = 'production';
6868
const rsbuild = await createStubRsbuild({
6969
plugins: [pluginSwc()],
70-
rsbuildConfig: {
70+
config: {
7171
provider: webpackProvider,
7272
},
7373
});
@@ -82,7 +82,7 @@ describe('plugin-webpack-swc', () => {
8282

8383
const rsbuild = await createStubRsbuild({
8484
plugins: [pluginSwc()],
85-
rsbuildConfig: {
85+
config: {
8686
output: {
8787
legalComments: 'none',
8888
},
@@ -102,7 +102,7 @@ describe('plugin-webpack-swc', () => {
102102

103103
const rsbuild = await createStubRsbuild({
104104
plugins: [pluginSwc()],
105-
rsbuildConfig: {
105+
config: {
106106
output: {
107107
charset: 'utf8',
108108
},
@@ -121,7 +121,7 @@ describe('plugin-webpack-swc', () => {
121121

122122
const rsbuild = await createStubRsbuild({
123123
plugins: [pluginSwc()],
124-
rsbuildConfig: {
124+
config: {
125125
output: {
126126
legalComments: 'inline',
127127
},
@@ -147,7 +147,7 @@ describe('plugin-webpack-swc', () => {
147147
},
148148
}),
149149
],
150-
rsbuildConfig: {
150+
config: {
151151
provider: webpackProvider,
152152
},
153153
});
@@ -170,7 +170,7 @@ describe('plugin-webpack-swc', () => {
170170
},
171171
}),
172172
],
173-
rsbuildConfig: {
173+
config: {
174174
provider: webpackProvider,
175175
},
176176
});
@@ -189,7 +189,7 @@ describe('plugin-webpack-swc', () => {
189189
cssMinify: false,
190190
}),
191191
],
192-
rsbuildConfig: {
192+
config: {
193193
provider: webpackProvider,
194194
},
195195
});
@@ -211,7 +211,7 @@ describe('plugin-webpack-swc', () => {
211211
minify: true,
212212
}),
213213
],
214-
rsbuildConfig: {
214+
config: {
215215
provider: webpackProvider,
216216
},
217217
});
@@ -225,7 +225,7 @@ describe('plugin-webpack-swc', () => {
225225

226226
const rsbuild = await createStubRsbuild({
227227
plugins: [pluginSwc()],
228-
rsbuildConfig: {
228+
config: {
229229
provider: webpackProvider,
230230
source: {
231231
include: [/foo/],
@@ -242,7 +242,7 @@ describe('plugin-webpack-swc', () => {
242242
process.env.NODE_ENV = 'development';
243243
const rsbuild = await createStubRsbuild({
244244
plugins: [pluginSwc()],
245-
rsbuildConfig: {
245+
config: {
246246
provider: webpackProvider,
247247
dev: {
248248
hmr: false,
@@ -260,7 +260,7 @@ describe('plugin-webpack-swc', () => {
260260

261261
const rsbuild = await createStubRsbuild({
262262
plugins: [pluginSwc()],
263-
rsbuildConfig: {
263+
config: {
264264
provider: webpackProvider,
265265
environments: {
266266
node: {
@@ -416,7 +416,7 @@ describe('plugin-webpack-swc', () => {
416416
},
417417
}),
418418
],
419-
rsbuildConfig: {
419+
config: {
420420
provider: webpackProvider,
421421
},
422422
});
@@ -444,7 +444,7 @@ describe('plugin-webpack-swc', () => {
444444
process.env.NODE_ENV = 'production';
445445
const rsbuild = await createStubRsbuild({
446446
plugins: [pluginSwc()],
447-
rsbuildConfig: {
447+
config: {
448448
provider: webpackProvider,
449449
environments: {
450450
web: {
@@ -474,7 +474,7 @@ describe('plugin-webpack-swc', () => {
474474
process.env.NODE_ENV = 'production';
475475
const rsbuild = await createStubRsbuild({
476476
plugins: [pluginSwc()],
477-
rsbuildConfig: {
477+
config: {
478478
provider: webpackProvider,
479479
environments: {
480480
web: {

packages/compat/webpack/tests/__snapshots__/default.test.ts.snap

Lines changed: 0 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = `
1717
},
1818
"context": "<ROOT>/packages/compat/webpack/tests",
1919
"devtool": "cheap-module-source-map",
20-
"entry": {
21-
"index": [
22-
"./src/index.js",
23-
],
24-
},
2520
"experiments": {
2621
"asyncWebAssembly": true,
2722
},
@@ -318,64 +313,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = `
318313
"name": "RsbuildCorePlugin",
319314
},
320315
HotModuleReplacementPlugin {},
321-
HtmlWebpackPlugin {
322-
"options": {
323-
"base": false,
324-
"cache": true,
325-
"chunks": [
326-
"index",
327-
],
328-
"chunksSortMode": "auto",
329-
"compile": true,
330-
"entryName": "index",
331-
"excludeChunks": [],
332-
"favicon": false,
333-
"filename": "index.html",
334-
"hash": false,
335-
"inject": "head",
336-
"meta": {
337-
"charset": {
338-
"charset": "UTF-8",
339-
},
340-
"viewport": "width=device-width, initial-scale=1.0",
341-
},
342-
"minify": "auto",
343-
"publicPath": "auto",
344-
"scriptLoading": "defer",
345-
"showErrors": true,
346-
"template": "",
347-
"templateContent": "<!doctype html><html><head></head><body><div id=\\"root\\"></div></body></html>",
348-
"templateParameters": [Function],
349-
"title": "Rsbuild App",
350-
"xhtml": false,
351-
Symbol(entryName): "index",
352-
},
353-
"userOptions": {
354-
"chunks": [
355-
"index",
356-
],
357-
"entryName": "index",
358-
"filename": "index.html",
359-
"inject": "head",
360-
"meta": {
361-
"charset": {
362-
"charset": "UTF-8",
363-
},
364-
"viewport": "width=device-width, initial-scale=1.0",
365-
},
366-
"scriptLoading": "defer",
367-
"template": "",
368-
"templateContent": "<!doctype html><html><head></head><body><div id=\\"root\\"></div></body></html>",
369-
"templateParameters": [Function],
370-
"title": "Rsbuild App",
371-
Symbol(entryName): "index",
372-
},
373-
"version": 5,
374-
},
375-
RsbuildHtmlPlugin {
376-
"getExtraData": [Function],
377-
"name": "RsbuildHtmlPlugin",
378-
},
379316
DefinePlugin {
380317
"definitions": {
381318
"import.meta.env": {
@@ -462,11 +399,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when produ
462399
},
463400
"context": "<ROOT>/packages/compat/webpack/tests",
464401
"devtool": false,
465-
"entry": {
466-
"index": [
467-
"./src/index.js",
468-
],
469-
},
470402
"experiments": {
471403
"asyncWebAssembly": true,
472404
},
@@ -760,64 +692,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when produ
760692
{
761693
"name": "RsbuildCorePlugin",
762694
},
763-
HtmlWebpackPlugin {
764-
"options": {
765-
"base": false,
766-
"cache": true,
767-
"chunks": [
768-
"index",
769-
],
770-
"chunksSortMode": "auto",
771-
"compile": true,
772-
"entryName": "index",
773-
"excludeChunks": [],
774-
"favicon": false,
775-
"filename": "index.html",
776-
"hash": false,
777-
"inject": "head",
778-
"meta": {
779-
"charset": {
780-
"charset": "UTF-8",
781-
},
782-
"viewport": "width=device-width, initial-scale=1.0",
783-
},
784-
"minify": "auto",
785-
"publicPath": "auto",
786-
"scriptLoading": "defer",
787-
"showErrors": true,
788-
"template": "",
789-
"templateContent": "<!doctype html><html><head></head><body><div id=\\"root\\"></div></body></html>",
790-
"templateParameters": [Function],
791-
"title": "Rsbuild App",
792-
"xhtml": false,
793-
Symbol(entryName): "index",
794-
},
795-
"userOptions": {
796-
"chunks": [
797-
"index",
798-
],
799-
"entryName": "index",
800-
"filename": "index.html",
801-
"inject": "head",
802-
"meta": {
803-
"charset": {
804-
"charset": "UTF-8",
805-
},
806-
"viewport": "width=device-width, initial-scale=1.0",
807-
},
808-
"scriptLoading": "defer",
809-
"template": "",
810-
"templateContent": "<!doctype html><html><head></head><body><div id=\\"root\\"></div></body></html>",
811-
"templateParameters": [Function],
812-
"title": "Rsbuild App",
813-
Symbol(entryName): "index",
814-
},
815-
"version": 5,
816-
},
817-
RsbuildHtmlPlugin {
818-
"getExtraData": [Function],
819-
"name": "RsbuildHtmlPlugin",
820-
},
821695
DefinePlugin {
822696
"definitions": {
823697
"import.meta.env": {
@@ -904,11 +778,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
904778
},
905779
"context": "<ROOT>/packages/compat/webpack/tests",
906780
"devtool": false,
907-
"entry": {
908-
"index": [
909-
"./src/index.js",
910-
],
911-
},
912781
"experiments": {
913782
"asyncWebAssembly": true,
914783
},
@@ -1276,11 +1145,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
12761145
},
12771146
"context": "<ROOT>/packages/compat/webpack/tests",
12781147
"devtool": false,
1279-
"entry": {
1280-
"index": [
1281-
"./src/index.js",
1282-
],
1283-
},
12841148
"experiments": {
12851149
"asyncWebAssembly": true,
12861150
},

packages/compat/webpack/tests/default.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe('applyDefaultPlugins', () => {
66
const { NODE_ENV } = process.env;
77
process.env.NODE_ENV = 'development';
88
const rsbuild = await createStubRsbuild({
9-
rsbuildConfig: {
9+
config: {
1010
_privateMeta: {
1111
configFilePath: '/path/to/rsbuild.config.ts',
1212
},
@@ -36,7 +36,7 @@ describe('applyDefaultPlugins', () => {
3636
const { NODE_ENV } = process.env;
3737
process.env.NODE_ENV = 'production';
3838
const rsbuild = await createStubRsbuild({
39-
rsbuildConfig: {
39+
config: {
4040
output: {
4141
target: 'web-worker',
4242
},
@@ -54,7 +54,7 @@ describe('applyDefaultPlugins', () => {
5454
const { NODE_ENV } = process.env;
5555
process.env.NODE_ENV = 'production';
5656
const rsbuild = await createStubRsbuild({
57-
rsbuildConfig: {
57+
config: {
5858
output: {
5959
target: 'node',
6060
},

packages/compat/webpack/tests/environment.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ describe('environment config', () => {
44
it('tools.webpack / bundlerChain can be used in environment config', async () => {
55
const rsbuild = await createStubRsbuild({
66
plugins: [],
7-
rsbuildConfig: {
7+
config: {
88
tools: {
99
webpack(config) {
1010
return {

packages/compat/webpack/tests/helper.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import { createStubRsbuild as createBaseRsbuild } from '@scripts/test-helper';
33
import { webpackProvider } from '../src/provider';
44

55
export async function createStubRsbuild({
6-
rsbuildConfig = {},
6+
config = {},
77
plugins,
88
...options
99
}: CreateRsbuildOptions & {
1010
plugins?: RsbuildPlugins;
1111
}) {
12-
rsbuildConfig.provider = webpackProvider;
12+
config.provider = webpackProvider;
1313
return createBaseRsbuild({
14-
rsbuildConfig,
14+
config,
1515
plugins,
1616
...options,
1717
});

packages/compat/webpack/tests/initConfigs.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('modifyRsbuildConfig', () => {
3232

3333
it('should modify config by utils', async () => {
3434
const rsbuild = await createStubRsbuild({
35-
rsbuildConfig: {
35+
config: {
3636
source: {
3737
entry: {
3838
main: 'src/index.ts',

0 commit comments

Comments
 (0)