Skip to content

Commit

Permalink
Merge pull request #4471 from SteveMieskoski/increase-coverage-for-Au…
Browse files Browse the repository at this point in the history
…tomaticPrefetchPlugin

add tests to test/WatchCases for AutomaticPrefetchPlugin
  • Loading branch information
sokra committed Mar 18, 2017
2 parents fadafb2 + a920c12 commit 335ce5f
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/watchCases/plugins/automatic-prefetch-plugin/0/foo/0.js
@@ -0,0 +1,5 @@
var a = require("./a");
var b = require("./b");
var c = require("./c");

module.exports = a + b + c + '.0';
@@ -0,0 +1 @@
module.exports = "This ";
@@ -0,0 +1 @@
module.exports = "is only ";
@@ -0,0 +1 @@
module.exports = "a test";
9 changes: 9 additions & 0 deletions test/watchCases/plugins/automatic-prefetch-plugin/0/index.js
@@ -0,0 +1,9 @@
it("should watch for changes", function() {
require("./foo/" + WATCH_STEP).should.be.eql('This is only a test.' + WATCH_STEP);
if(+WATCH_STEP > 0) {
STATS_JSON.modules[0].prefetched.should.be.true();
STATS_JSON.modules[1].prefetched.should.be.true();
STATS_JSON.modules[2].prefetched.should.be.true();
STATS_JSON.modules[3].prefetched.should.be.true();
}
});
5 changes: 5 additions & 0 deletions test/watchCases/plugins/automatic-prefetch-plugin/1/foo/1.js
@@ -0,0 +1,5 @@
var a = require("./a");
var b = require("./b");
var c = require("./c");

module.exports = a + b + c + '.1';
5 changes: 5 additions & 0 deletions test/watchCases/plugins/automatic-prefetch-plugin/2/foo/2.js
@@ -0,0 +1,5 @@
var a = require("./a");
var b = require("./b");
var c = require("./c");

module.exports = a + b + c + '.2';
5 changes: 5 additions & 0 deletions test/watchCases/plugins/automatic-prefetch-plugin/3/foo/3.js
@@ -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,6 @@
var webpack = require("../../../../");
module.exports = {
plugins: [
new webpack.AutomaticPrefetchPlugin()
]
};

0 comments on commit 335ce5f

Please sign in to comment.