Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Feb 4, 2016
1 parent 6ac8713 commit 119a386
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 19 deletions.
16 changes: 8 additions & 8 deletions test/browsertest/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ console.log("compile scripts...");
var extraArgsNoWatch = extraArgs.slice(0);
var watchIndex = extraArgsNoWatch.indexOf("--watch");
if(watchIndex != -1) extraArgsNoWatch.splice(watchIndex, 1);
// node ../../bin/webpack --output-pathinfo --colors --optimize-max-chunks 1 --output-library library1 node_modules/library1 js/library1
var library1 = cp.spawn("node", join(["../../bin/webpack.js", "--output-pathinfo", "--colors", "--optimize-max-chunks", "1", "--output-library", "library1",
// node ../../bin/webpack --output-pathinfo --color --optimize-max-chunks 1 --output-library library1 node_modules/library1 js/library1
var library1 = cp.spawn("node", join(["../../bin/webpack.js", "--output-pathinfo", "--color", "--optimize-max-chunks", "1", "--output-library", "library1",
"node_modules/library1", "js/library1.js"], extraArgsNoWatch));
bindOutput(library1);
library1.on("exit", function(code) {
if(code === 0) {
// 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]"
var main = cp.spawn("node", join(["../../bin/webpack.js", "--output-pathinfo", "--colors", "--resolve-alias", "vm=vm-browserify", "--workers",
"--output-public-path", "js/", "--output-chunk-file", "[name].web.js",
// 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]"
var main = cp.spawn("node", join(["../../bin/webpack.js", "--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/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));
bindOutput(main);
}
});
// 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
var library2 = cp.spawn("node", join(["../../bin/webpack.js", "--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"], extraArgsNoWatch));
// 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
var library2 = cp.spawn("node", join(["../../bin/webpack.js", "--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"], extraArgsNoWatch));
bindOutput(library2);
4 changes: 2 additions & 2 deletions test/browsertest/library2config.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports.default = new Promise (resolve, reject) ->
hashDigestLength: 5
module:
postLoaders: [
{ test: /extra2?\.js/, loader: "raw!extra!val?cacheable" }
{ test: /extra2?\.js/, loader: "raw!./node_modules/extra.loader.js!val?cacheable" }
]
amd:
fromOptions: true
Expand All @@ -19,7 +19,7 @@ exports.default = new Promise (resolve, reject) ->
should: require.resolve "should"
plugins: [
new webpack.optimize.LimitChunkCountPlugin
maxChunks: 2
maxChunks: 3
new webpack.optimize.CommonsChunkPlugin
name: "common"
filename: "library2.commons.js"
Expand Down
6 changes: 3 additions & 3 deletions test/browsertest/node_modules/library2/lib/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions test/browsertest/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
resolve: {
modules: ["web_modules", "node_modules"],
extensions: [".json", ".web.js", ".js"]
},
resolveLoader: {
extensions: [".json", ".webpack-loader.js", ".web-loader.js", ".loader.js", ".js"],
mainFields: ["webpackLoader", "loader", "main"]
}
}
16 changes: 10 additions & 6 deletions test/cases/chunks/runtime/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,23 @@ it("should handle duplicate chunks", function(done) {
it("should not load a chunk which is included in a already loaded one", function(done) {
var async = false;
require.ensure(["./empty?x", "./empty?y", "./empty?z"], function(require) {
async.should.be.eql(true);
loadChunk();
try {
async.should.be.eql(true);
loadChunk();
} catch(e) { done(e); }
});
Promise.resolve().then(function() {
Promise.resolve().then(function() {}).then(function() {}).then(function() {
async = true;
});
function loadChunk() {
var sync = true;
require.ensure(["./empty?x", "./empty?y"], function(require) {
sync.should.be.eql(true);
done();
try {
sync.should.be.eql(true);
done();
} catch(e) { done(e); }
});
Promise.resolve().then(function() {}).then(function() {
Promise.resolve().then(function() {}).then(function() {}).then(function() {
sync = false;
});
}
Expand Down

0 comments on commit 119a386

Please sign in to comment.