Skip to content

Commit

Permalink
write out stats test results
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Jan 6, 2016
1 parent c838656 commit f7c232c
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions test/Stats.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
var should = require("should");
var path = require("path");
var fs = require("fs");
var mkdirp = require("mkdirp");

var webpack = require("../lib/webpack");

var base = path.join(__dirname, "statsCases");
var outputBase = path.join(__dirname, "js", "stats");
var tests = fs.readdirSync(base);
var Stats = require("../lib/Stats");

Expand All @@ -23,22 +25,12 @@ describe("Stats", function() {
}
(Array.isArray(options) ? options : [options]).forEach(function(options) {
options.context = path.join(base, testName);
options.output = options.output || {};
options.output.path = path.join(outputBase, testName);
});
var c = webpack(options);
var files = {};
var compilers = c.compilers ? c.compilers : [c];
compilers.forEach(function(c) {
c.outputFileSystem = {
join: path.join.bind(path),
mkdirp: function(path, callback) {
callback();
},
writeFile: function(name, content, callback) {
files[name] = content.toString("utf-8");
callback();
}
};

var ifs = c.inputFileSystem;
c.inputFileSystem = Object.create(ifs);
c.inputFileSystem.readFile = function() {
Expand Down

0 comments on commit f7c232c

Please sign in to comment.