Skip to content

Commit 0af9c81

Browse files
authored
test: add test case for excludeOutput (#8)
1 parent 8317dc0 commit 0af9c81

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ At this time, the build artifacts can include all syntax supported by ES2020, su
136136
- **Type:** `RegExp | RegExp[]`
137137
- **Default:** `undefined`
138138
139-
`exclude` is used to exclude a portion of files during detection. You can pass in one or more regular expressions to match the paths of source files. Files that match the regular expression will be ignored and will not trigger syntax checking.
139+
`exclude` is used to exclude a portion of source files during detection. You can pass in one or more regular expressions to match the paths of source files. Files that match the regular expression will be ignored and will not trigger syntax checking.
140140
141141
- **Example:**
142142

test/basic/index.test.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ test('should check assets with query correctly', async () => {
9292
).toBeTruthy();
9393
});
9494

95-
test('should not throw error when the file is excluded', async () => {
95+
test('should not throw error when the source file is excluded', async () => {
9696
const rsbuild = await createRsbuild({
9797
cwd: __dirname,
9898
rsbuildConfig: {
@@ -108,6 +108,22 @@ test('should not throw error when the file is excluded', async () => {
108108
await expect(rsbuild.build()).resolves.toBeTruthy();
109109
});
110110

111+
test('should not throw error when the output file is excluded', async () => {
112+
const rsbuild = await createRsbuild({
113+
cwd: __dirname,
114+
rsbuildConfig: {
115+
...(await loadConfig({ cwd: __dirname })).content,
116+
plugins: [
117+
pluginCheckSyntax({
118+
excludeOutput: /dist\/static\/js\//,
119+
}),
120+
],
121+
},
122+
});
123+
124+
await expect(rsbuild.build()).resolves.toBeTruthy();
125+
});
126+
111127
test('should not throw error when the targets are support es6', async () => {
112128
const rsbuild = await createRsbuild({
113129
cwd: __dirname,

0 commit comments

Comments
 (0)