Skip to content

Commit ddd1134

Browse files
committed
fix: code formatting
1 parent 702b23e commit ddd1134

File tree

1 file changed

+70
-60
lines changed

1 file changed

+70
-60
lines changed

test/TestCases.test.js

+70-60
Original file line numberDiff line numberDiff line change
@@ -9,71 +9,81 @@ describe('TestCases', () => {
99
for (const directory of fs.readdirSync(casesDirectory)) {
1010
if (!/^(\.|_)/.test(directory)) {
1111
// eslint-disable-next-line no-loop-func
12-
it(`${directory} should compile to the expected result`, (done) => {
13-
const directoryForCase = path.resolve(casesDirectory, directory);
14-
const outputDirectoryForCase = path.resolve(outputDirectory, directory);
15-
// eslint-disable-next-line import/no-dynamic-require, global-require
16-
const webpackConfig = require(path.resolve(
17-
directoryForCase,
18-
'webpack.config.js'
19-
));
20-
for (const config of [].concat(webpackConfig)) {
21-
Object.assign(
22-
config,
23-
{
24-
mode: 'none',
25-
context: directoryForCase,
26-
output: Object.assign(
27-
{
28-
path: outputDirectoryForCase,
29-
},
30-
config.output
31-
),
32-
},
33-
config
12+
it(
13+
`${directory} should compile to the expected result`,
14+
(done) => {
15+
const directoryForCase = path.resolve(casesDirectory, directory);
16+
const outputDirectoryForCase = path.resolve(
17+
outputDirectory,
18+
directory
3419
);
35-
}
36-
webpack(webpackConfig, (err, stats) => {
37-
if (err) {
38-
done(err);
39-
return;
40-
}
41-
done();
42-
// eslint-disable-next-line no-console
43-
console.log(
44-
stats.toString({
45-
context: path.resolve(__dirname, '..'),
46-
chunks: true,
47-
chunkModules: true,
48-
modules: false,
49-
})
50-
);
51-
if (stats.hasErrors()) {
52-
done(
53-
new Error(
54-
stats.toString({
55-
context: path.resolve(__dirname, '..'),
56-
errorDetails: true,
57-
})
58-
)
20+
// eslint-disable-next-line import/no-dynamic-require, global-require
21+
const webpackConfig = require(path.resolve(
22+
directoryForCase,
23+
'webpack.config.js'
24+
));
25+
for (const config of [].concat(webpackConfig)) {
26+
Object.assign(
27+
config,
28+
{
29+
mode: 'none',
30+
context: directoryForCase,
31+
output: Object.assign(
32+
{
33+
path: outputDirectoryForCase,
34+
},
35+
config.output
36+
),
37+
},
38+
config
5939
);
60-
return;
6140
}
62-
const expectedDirectory = path.resolve(directoryForCase, 'expected');
63-
64-
for (const file of walkSync(expectedDirectory)) {
65-
const actualFilePath = file.replace(
66-
new RegExp(`/cases/${directory}/expected/`),
67-
`/js/${directory}/`
41+
webpack(webpackConfig, (err, stats) => {
42+
if (err) {
43+
done(err);
44+
return;
45+
}
46+
done();
47+
// eslint-disable-next-line no-console
48+
console.log(
49+
stats.toString({
50+
context: path.resolve(__dirname, '..'),
51+
chunks: true,
52+
chunkModules: true,
53+
modules: false,
54+
})
55+
);
56+
if (stats.hasErrors()) {
57+
done(
58+
new Error(
59+
stats.toString({
60+
context: path.resolve(__dirname, '..'),
61+
errorDetails: true,
62+
})
63+
)
64+
);
65+
return;
66+
}
67+
const expectedDirectory = path.resolve(
68+
directoryForCase,
69+
'expected'
6870
);
69-
const expectedContent = fs.readFileSync(file, 'utf-8');
70-
const actualContent = fs.readFileSync(actualFilePath, 'utf-8');
7171

72-
expect(actualContent).toEqual(expectedContent);
73-
}
74-
done();
75-
});
76-
}, 10000);
72+
for (const file of walkSync(expectedDirectory)) {
73+
const actualFilePath = file.replace(
74+
new RegExp(`/cases/${directory}/expected/`),
75+
`/js/${directory}/`
76+
);
77+
const expectedContent = fs.readFileSync(file, 'utf-8');
78+
const actualContent = fs.readFileSync(actualFilePath, 'utf-8');
79+
80+
expect(actualContent).toEqual(expectedContent);
81+
}
82+
done();
83+
});
84+
},
85+
10000
86+
);
7787
}
7888
}
7989
});

0 commit comments

Comments
 (0)