Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix asset cache with "extract-text-webpack-plugin" #3806

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 21 additions & 10 deletions test/WatchTestCases.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,27 @@ describe("WatchTestCases", () => {
_require(outputDirectory, "./bundle.js");

if(exportedTests < 1) return done(new Error("No tests exported by test case"));
runIdx++;
if(runIdx < runs.length) {
run = runs[runIdx];
setTimeout(() => {
copyDiff(path.join(testDirectory, run.name), tempDirectory);
}, 1500);
} else {
watching.close();
process.nextTick(done);
}

var skipStepDelay = 500;
var nextStep = function() {
runIdx++;
if(runIdx < runs.length) {
run = runs[runIdx];
setTimeout(function() {
copyDiff(path.join(testDirectory, run.name), tempDirectory);
var runReference = runIdx;
setTimeout(function() {
if(runReference == runIdx) {
nextStep();
}
}, skipStepDelay);
}, 1500);
} else {
watching.close();
process.nextTick(done);
}
};
nextStep();
});
});
});
Expand Down
6 changes: 3 additions & 3 deletions test/statsCases/separate-css-bundle/expected.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Hash: 0be4035986816982617a1139e89514abc13454ce
Hash: 3a94b16fac8bc7176bab0eec561d85889150f958
Child
Hash: 0be4035986816982617a
Hash: 3a94b16fac8bc7176bab
Time: Xms
Asset Size Chunks Chunk Names
c7ab11336573e45dc51e.js 2.77 kB 0 [emitted] main
Expand All @@ -13,7 +13,7 @@ Child
[0] (webpack)/~/css-loader!(webpack)/test/statsCases/separate-css-bundle/a/file.css 190 bytes {0} [built]
[1] (webpack)/~/css-loader/lib/css-base.js 1.46 kB {0} [built]
Child
Hash: 1139e89514abc13454ce
Hash: 0eec561d85889150f958
Time: Xms
Asset Size Chunks Chunk Names
c7ab11336573e45dc51e.js 2.77 kB 0 [emitted] main
Expand Down
8 changes: 8 additions & 0 deletions test/watchCases/plugins/extract-text-plugin/0/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import "./style.css"
import x from "./script"

it("should handle css changes", function() {
switch(WATCH_STEP) {
case "0":
STATE.first = STATS_JSON.hash;
break;
case "1":
STATE.second = STATS_JSON.hash;
STATS_JSON.hash.should.not.be.eql(STATE.first, "stats hash should have changed, but didn't");
break;
case "2":
throw new Error("noop css change should not trigger update")
break;
case "3":
throw new Error("noop js change should not trigger update")
break;
}
});
1 change: 1 addition & 0 deletions test/watchCases/plugins/extract-text-plugin/0/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = ""
3 changes: 3 additions & 0 deletions test/watchCases/plugins/extract-text-plugin/2/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.x {
background: red;
}
1 change: 1 addition & 0 deletions test/watchCases/plugins/extract-text-plugin/3/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = ""
1 change: 1 addition & 0 deletions test/watchCases/plugins/extract-text-plugin/4/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = "flush"
1 change: 1 addition & 0 deletions test/watchCases/simple/noop-change/0/changing-file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = "0"
10 changes: 10 additions & 0 deletions test/watchCases/simple/noop-change/0/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import "./noop-changing-file.js"
import "./changing-file.js"

it("should ignore change", function() {
switch(WATCH_STEP) {
case "1":
throw new Error("noop change should not trigger update")
break;
}
});
1 change: 1 addition & 0 deletions test/watchCases/simple/noop-change/0/noop-changing-file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = ""
1 change: 1 addition & 0 deletions test/watchCases/simple/noop-change/1/noop-changing-file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = ""
1 change: 1 addition & 0 deletions test/watchCases/simple/noop-change/2/changing-file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = "flush"