-
-
Notifications
You must be signed in to change notification settings - Fork 579
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: falsy rule should not pass the validation (#8297)
- Loading branch information
1 parent
a3ae37c
commit 638b82f
Showing
12 changed files
with
79 additions
and
24 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
packages/rspack-test-tools/tests/configCases/module/falsy/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { lib, lib1 } from "./lib"; | ||
|
||
it("`oneOf` should work", () => { | ||
// should run loader & loader2 and not run loader1 | ||
expect(lib).toEqual("aabc"); | ||
|
||
expect(lib1).toEqual("effg"); | ||
}); |
3 changes: 3 additions & 0 deletions
3
packages/rspack-test-tools/tests/configCases/module/falsy/lib.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const lib = "abc"; | ||
|
||
export const lib1 = "efg"; |
3 changes: 3 additions & 0 deletions
3
packages/rspack-test-tools/tests/configCases/module/falsy/loader.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function (content) { | ||
this.callback(null, content.replace("ab", "aab")); | ||
}; |
3 changes: 3 additions & 0 deletions
3
packages/rspack-test-tools/tests/configCases/module/falsy/loader1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function (content) { | ||
this.callback(null, content.replace("bc", "bcc")); | ||
}; |
3 changes: 3 additions & 0 deletions
3
packages/rspack-test-tools/tests/configCases/module/falsy/loader2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function (content) { | ||
this.callback(null, content.replace("ef", "eff")); | ||
}; |
31 changes: 31 additions & 0 deletions
31
packages/rspack-test-tools/tests/configCases/module/falsy/rspack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* @type {import('@rspack/core').RspackOptions} | ||
*/ | ||
module.exports = { | ||
context: __dirname, | ||
module: { | ||
rules: [ | ||
undefined, | ||
{ | ||
test: /lib.js/, | ||
use: ["./loader2.js"] | ||
}, | ||
{ | ||
test: /lib.js/, | ||
oneOf: [ | ||
undefined, | ||
{ | ||
resourceQuery: "/(__inline=false|url)/", | ||
use: ["./loader1.js"] | ||
}, | ||
{ | ||
use: ["./loader.js"] | ||
}, | ||
{ | ||
use: ["./loader1.js"] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
638b82f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Ran ecosystem CI: Open
638b82f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Benchmark detail: Open