Skip to content

Commit 926d94a

Browse files
committed
add tests for ignored context modules
1 parent eae28fa commit 926d94a

12 files changed

Lines changed: 84 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = "ignored";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = "normal";
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/* globals it */
2+
"use strict";
3+
4+
it("should ignore ignored resources", function() {
5+
const folderBContext = function(mod) {
6+
require("./src/" + mod);
7+
};
8+
9+
(function() {
10+
folderBContext("ignored-module");
11+
}).should.throw();
12+
});
13+
it("should not ignore resources that do not match", function() {
14+
const folderBContext = function(mod) {
15+
require("./src/" + mod);
16+
};
17+
18+
(function() {
19+
folderBContext("normal-module");
20+
}).should.not.throw();
21+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"use strict";
2+
3+
const IgnorePlugin = require("../../../../lib/IgnorePlugin");
4+
5+
module.exports = {
6+
entry: "./test.js",
7+
plugins: [
8+
new IgnorePlugin(/ignored-module/)
9+
],
10+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = "ignored";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("./normal-module");
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = "ignored";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("./ignored-module");
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = "should be fine";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("./only-context-match-require");

0 commit comments

Comments
 (0)