html-render-webpack-plugin
Version:
webpack plugin for rendering static HTML in a multi-config webpack build
29 lines (22 loc) • 837 B
JavaScript
const { createInMemoryFileSystem } = require("../../utils/memory-fs");
const webpack = require("webpack");
const path = require("path");
const config = require("./webpack.config");
const getDirContentsSync = require("../../utils/getDirContentsSync");
describe("Render WebpackStats", () => {
const renderDirectory = path.join(process.cwd(), "dist", "render");
it("should render a with asset names", async (done) => {
const compiler = webpack(config);
const memoryFs = createInMemoryFileSystem();
compiler.outputFileSystem = memoryFs;
compiler.run((error, stats) => {
if (error) {
throw error;
}
expect(stats.hasErrors()).toBe(false);
const contents = getDirContentsSync(renderDirectory, { fs: memoryFs });
expect(contents).toMatchSnapshot();
done();
});
});
});