forked from webpack-contrib/mini-css-extract-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenforce-esm.test.js
36 lines (34 loc) · 951 Bytes
/
enforce-esm.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { getCompiler, source, compile } from './helpers';
it('should enforce esm for empty module with options.esModule', async (done) => {
const compiler = getCompiler(
'./esm.js',
{ esModule: true },
{
mode: 'production',
optimization: { minimize: false },
}
);
const stats = await compile(compiler);
expect(stats.hasErrors()).toBe(false);
expect(source('./simple.css', stats)).toMatchInlineSnapshot(`
"// extracted by mini-css-extract-plugin
export {};"
`);
done();
});
it('should keep empty module without options.esModule', async (done) => {
const compiler = getCompiler(
'./esm.js',
{},
{
mode: 'production',
optimization: { minimize: false },
}
);
const stats = await compile(compiler);
expect(stats.hasErrors()).toBe(false);
expect(source('./simple.css', stats)).toMatchInlineSnapshot(
`"// extracted by mini-css-extract-plugin"`
);
done();
});