webpack/test/MultiStats.test.js

34 lines
739 B
JavaScript
Raw Normal View History

"use strict";
const webpack = require("..");
2020-02-13 00:13:53 +08:00
const { createFsFromVolume, Volume } = require("memfs");
describe("MultiStats", () => {
it("should create JSON of children stats", done => {
2019-02-19 15:58:46 +08:00
const compiler = webpack([
{
context: __dirname,
entry: "./fixtures/a"
},
{
context: __dirname,
entry: "./fixtures/b"
}
]);
2020-02-13 00:13:53 +08:00
compiler.outputFileSystem = new createFsFromVolume(new Volume());
compiler.run((err, stats) => {
if (err) return done(err);
try {
const statsObject = stats.toJson();
2019-02-19 15:58:46 +08:00
expect(statsObject).toEqual(
expect.objectContaining({ children: expect.any(Array) })
);
expect(statsObject.children).toHaveLength(2);
done();
} catch (e) {
done(e);
}
});
});
});