Skip to content

Commit 119a386

Browse files
committed
fixed tests
1 parent 6ac8713 commit 119a386

5 files changed

Lines changed: 33 additions & 19 deletions

File tree

‎test/browsertest/build.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ console.log("compile scripts...");
2828
var extraArgsNoWatch = extraArgs.slice(0);
2929
var watchIndex = extraArgsNoWatch.indexOf("--watch");
3030
if(watchIndex != -1) extraArgsNoWatch.splice(watchIndex, 1);
31-
// node ../../bin/webpack --output-pathinfo --colors --optimize-max-chunks 1 --output-library library1 node_modules/library1 js/library1
32-
var library1 = cp.spawn("node", join(["../../bin/webpack.js", "--output-pathinfo", "--colors", "--optimize-max-chunks", "1", "--output-library", "library1",
31+
// node ../../bin/webpack --output-pathinfo --color --optimize-max-chunks 1 --output-library library1 node_modules/library1 js/library1
32+
var library1 = cp.spawn("node", join(["../../bin/webpack.js", "--output-pathinfo", "--color", "--optimize-max-chunks", "1", "--output-library", "library1",
3333
"node_modules/library1", "js/library1.js"], extraArgsNoWatch));
3434
bindOutput(library1);
3535
library1.on("exit", function(code) {
3636
if(code === 0) {
37-
// node ../../bin/webpack --output-pathinfo --colors --resolve-alias vm=vm-browserify --output-public-path js/ --output-chunk-file [name].web.js --module-bind json --module-bind css=style!css --module-bind less=style!css!less --module-bind coffee --module-bind jade --prefetch ./lib/stylesheet.less --optimize-dedupe --labeled-modules ./lib/index "js/web.js?h=[hash]"
38-
var main = cp.spawn("node", join(["../../bin/webpack.js", "--output-pathinfo", "--colors", "--resolve-alias", "vm=vm-browserify", "--workers",
39-
"--output-public-path", "js/", "--output-chunk-file", "[name].web.js",
37+
// node ../../bin/webpack --output-pathinfo --color --resolve-alias vm=vm-browserify --output-public-path js/ --output-chunk-filename [name].web.js --module-bind json --module-bind css=style!css --module-bind less=style!css!less --module-bind coffee --module-bind jade --prefetch ./lib/stylesheet.less --optimize-dedupe --labeled-modules ./lib/index "js/web.js?h=[hash]"
38+
var main = cp.spawn("node", join(["../../bin/webpack.js", "--output-pathinfo", "--color", "--resolve-alias", "vm=vm-browserify",
39+
"--output-public-path", "js/", "--output-chunk-filename", "[name].web.js",
4040
"--module-bind", "json", "--module-bind", "css=style!css", "--module-bind", "less=style/url!file?postfix=.css&string!less", "--module-bind", "coffee", "--module-bind", "jade", "--prefetch", "./lib/stylesheet.less", "--optimize-dedupe", "--labeled-modules", "./lib/index", "js/web.js?h=[hash]", "--progress"], extraArgs));
4141
bindOutput(main);
4242
}
4343
});
44-
// node ../../bin/webpack --output-pathinfo --colors --output-library-target umd --output-jsonp-function webpackJsonpLib2 --output-public-path js/ --output-chunk-file [chunkhash].lib2.js --config library2config.coffee library2b library2 js/library2.js
45-
var library2 = cp.spawn("node", join(["../../bin/webpack.js", "--output-pathinfo", "--colors", "--output-library-target", "umd", "--output-jsonp-function", "webpackJsonpLib2",
46-
"--output-public-path", "js/", "--output-chunk-file", "[chunkhash].lib2.js", "--config", "library2config.coffee", "library2b", "library2", "js/library2.js"], extraArgsNoWatch));
44+
// node ../../bin/webpack --output-pathinfo --color --output-library-target umd --output-jsonp-function webpackJsonpLib2 --output-public-path js/ --output-chunk-filename [chunkhash].lib2.js --config library2config.coffee library2b library2 js/library2.js
45+
var library2 = cp.spawn("node", join(["../../bin/webpack.js", "--output-pathinfo", "--color", "--output-library-target", "umd", "--output-jsonp-function", "webpackJsonpLib2",
46+
"--output-public-path", "js/", "--output-chunk-filename", "[chunkhash].lib2.js", "--config", "library2config.coffee", "library2b", "library2", "js/library2.js"], extraArgsNoWatch));
4747
bindOutput(library2);

‎test/browsertest/library2config.coffee‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ exports.default = new Promise (resolve, reject) ->
88
hashDigestLength: 5
99
module:
1010
postLoaders: [
11-
{ test: /extra2?\.js/, loader: "raw!extra!val?cacheable" }
11+
{ test: /extra2?\.js/, loader: "raw!./node_modules/extra.loader.js!val?cacheable" }
1212
]
1313
amd:
1414
fromOptions: true
@@ -19,7 +19,7 @@ exports.default = new Promise (resolve, reject) ->
1919
should: require.resolve "should"
2020
plugins: [
2121
new webpack.optimize.LimitChunkCountPlugin
22-
maxChunks: 2
22+
maxChunks: 3
2323
new webpack.optimize.CommonsChunkPlugin
2424
name: "common"
2525
filename: "library2.commons.js"

‎test/browsertest/node_modules/library2/lib/main.js‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎test/browsertest/webpack.config.js‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
resolve: {
3+
modules: ["web_modules", "node_modules"],
4+
extensions: [".json", ".web.js", ".js"]
5+
},
6+
resolveLoader: {
7+
extensions: [".json", ".webpack-loader.js", ".web-loader.js", ".loader.js", ".js"],
8+
mainFields: ["webpackLoader", "loader", "main"]
9+
}
10+
}

‎test/cases/chunks/runtime/index.js‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,23 @@ it("should handle duplicate chunks", function(done) {
1919
it("should not load a chunk which is included in a already loaded one", function(done) {
2020
var async = false;
2121
require.ensure(["./empty?x", "./empty?y", "./empty?z"], function(require) {
22-
async.should.be.eql(true);
23-
loadChunk();
22+
try {
23+
async.should.be.eql(true);
24+
loadChunk();
25+
} catch(e) { done(e); }
2426
});
25-
Promise.resolve().then(function() {
27+
Promise.resolve().then(function() {}).then(function() {}).then(function() {
2628
async = true;
2729
});
2830
function loadChunk() {
2931
var sync = true;
3032
require.ensure(["./empty?x", "./empty?y"], function(require) {
31-
sync.should.be.eql(true);
32-
done();
33+
try {
34+
sync.should.be.eql(true);
35+
done();
36+
} catch(e) { done(e); }
3337
});
34-
Promise.resolve().then(function() {}).then(function() {
38+
Promise.resolve().then(function() {}).then(function() {}).then(function() {
3539
sync = false;
3640
});
3741
}

0 commit comments

Comments
 (0)