Skip to content

Commit

Permalink
Merge pull request #12827 from dmattia/master
Browse files Browse the repository at this point in the history
Add a test case for resolve.fallback
  • Loading branch information
sokra committed Mar 8, 2021
2 parents 97064ee + b89b536 commit dace9fb
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/configCases/resolve/fallback/a/1.js
@@ -0,0 +1 @@
module.exports = 1;
1 change: 1 addition & 0 deletions test/configCases/resolve/fallback/a/2.js
@@ -0,0 +1 @@
module.exports = 'not 2';
1 change: 1 addition & 0 deletions test/configCases/resolve/fallback/b/2.js
@@ -0,0 +1 @@
module.exports = 2;
9 changes: 9 additions & 0 deletions test/configCases/resolve/fallback/index.js
@@ -0,0 +1,9 @@
it("ignores the fallback if an existing module is present", () => {
const two = require("./b/2");
expect(two).toBe(2);
});

it("can fallback if the module does not exist", () => {
const one = require("./b/1");
expect(one).toBe(1);
});
9 changes: 9 additions & 0 deletions test/configCases/resolve/fallback/webpack.config.js
@@ -0,0 +1,9 @@
const path = require("path");
/** @type {import("../../../../").Configuration} */
module.exports = {
resolve: {
fallback: {
"./b": path.resolve(__dirname, "a")
}
}
};

0 comments on commit dace9fb

Please sign in to comment.