mirror of https://github.com/webpack/webpack.git
add test case
This commit is contained in:
parent
f72b803ed6
commit
684d375541
|
|
@ -0,0 +1 @@
|
|||
})]
|
||||
|
|
@ -0,0 +1 @@
|
|||
module.exports = '0';
|
||||
|
|
@ -0,0 +1 @@
|
|||
module.exports = "This ";
|
||||
|
|
@ -0,0 +1 @@
|
|||
module.exports = "is only ";
|
||||
|
|
@ -0,0 +1 @@
|
|||
module.exports = "a test";
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
it("should watch for changes", function () {
|
||||
if (+WATCH_STEP !== 3) expect(require("./delayed")).toBe(WATCH_STEP);
|
||||
else expect(require("./delayed")).toBe("This is only a test." + WATCH_STEP);
|
||||
if (+WATCH_STEP > 0) {
|
||||
for (var m of STATS_JSON.modules.filter(m =>
|
||||
/(a|b|c)\.js$/.test(m.identifier)
|
||||
))
|
||||
expect(m.issuer).toBe(null);
|
||||
}
|
||||
});
|
||||
|
|
@ -0,0 +1 @@
|
|||
module.exports = '1';
|
||||
|
|
@ -0,0 +1 @@
|
|||
module.exports = '2';
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
var a = require("./a");
|
||||
var b = require("./b");
|
||||
var c = require("./c");
|
||||
|
||||
module.exports = a + b + c + '.3';
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
module.exports = function (source) {
|
||||
expect(source).toMatch(/^\}\)\]/);
|
||||
this.cacheable(false);
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
resolve("module.exports = require('./foo/' + WATCH_STEP);");
|
||||
}, 500);
|
||||
});
|
||||
};
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
const path = require("path");
|
||||
const webpack = require("../../../../");
|
||||
|
||||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /delayed/,
|
||||
use: path.resolve(__dirname, "./delayed")
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [new webpack.AutomaticPrefetchPlugin()]
|
||||
};
|
||||
Loading…
Reference in New Issue