html-render-webpack-plugin
Version:
webpack plugin for rendering static HTML in a multi-config webpack build
25 lines (19 loc) • 769 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("with extra globals in scope", () => {
const renderDirectory = path.join(process.cwd(), "dist", "render");
it("should render a HTML file", async (done) => {
const compiler = webpack(config);
const memoryFs = createInMemoryFileSystem();
compiler.outputFileSystem = memoryFs;
compiler.run((error) => {
expect(error).toBe(null);
const contents = getDirContentsSync(renderDirectory, { fs: memoryFs });
expect(contents).toMatchSnapshot();
done();
});
});
});