Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('produces a webpack config and friendly manifest plugin', async () => {
simulate
.statsAsDirectory()
.statsAsFile()
.productionEnvironment();
const { clientConfig: config } = await configureWebpack({ context: '.' });
expect(config).toMatchObject({
context: '.',
mode: 'production',
optimization: expect.any(Object)
});
expect(config.entry).toHaveProperty('client');
expect(config.module).toHaveProperty('rules');
expect(WebpackAssetsManifest).toHaveBeenCalled();
const { transform } = WebpackAssetsManifest.mock.calls[0][0];
const assets = {
entrypoints: {
client: {
js: ['client1.js', 'client2.js']
}
},
'toLoad.js': 'toLoad.compiled.js',
'RootCmp-FAKE.js': [
'RootCmp-FAKE-1.compiled.js',
'RootCmp-FAKE-2.compiled.js'
],
'RootCmp-FAKER.js': 'RootCmp-FAKER-1.compiled.js',
'image.svg': 'image-hash.svg'
};
transform(assets);