forked from webpack-contrib/css-loader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathicss.test.js
35 lines (31 loc) · 957 Bytes
/
icss.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
import path from 'path';
import fs from 'fs';
import {
compile,
getCompiler,
getErrors,
getExecutedCode,
getModuleSource,
getWarnings,
} from './helpers/index';
const testCasesPath = path.join(__dirname, 'fixtures/icss/tests-cases');
const testCases = fs.readdirSync(testCasesPath);
describe('ICSS', () => {
testCases.forEach((name) => {
it(`show work with the case "${name}"`, async () => {
const compiler = getCompiler(`./icss/tests-cases/${name}/source.js`, {
modules: false,
icss: true,
});
const stats = await compile(compiler);
expect(
getModuleSource(`./icss/tests-cases/${name}/source.css`, stats)
).toMatchSnapshot('module');
expect(
getExecutedCode('main.bundle.js', compiler, stats)
).toMatchSnapshot('result');
expect(getWarnings(stats)).toMatchSnapshot('warnings');
expect(getErrors(stats)).toMatchSnapshot('errors');
});
});
});