/
partials.js
42 lines (39 loc) · 1.17 KB
/
partials.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
37
38
39
40
41
42
'use strict';
const {all, testDefault, testSilent} = require('./tests');
const {buildDevNormal, buildDevBail, buildProdNormal, buildProdBail} = require('./builds');
const {onlyMeta, assertWebpackOk, assertWebpackNotOk, assertStdout} = require('../../lib/assert');
// Allow 1-N errors
// - webpack may repeat errors with a header line taken from the parent loader
const assertModuleNotFoundError = assertStdout('"Module not found" error')([1, 100])`
^[ ]*ERROR[^\n]*
[ ]*Module build failed(:|[^\n]*\n)[ ]*ModuleNotFoundError: Module not found:
`;
exports.moduleNotFound =
all(testDefault, testSilent)(
onlyMeta('meta.version.webpack ==1')(
buildDevBail(
assertWebpackNotOk
),
buildDevNormal(
assertWebpackOk,
assertModuleNotFoundError
),
buildProdBail(
assertWebpackNotOk
),
buildProdNormal(
assertWebpackOk,
assertModuleNotFoundError
)
),
onlyMeta('meta.version.webpack > 1')(
buildDevNormal(
assertWebpackNotOk,
assertModuleNotFoundError
),
buildProdNormal(
assertWebpackNotOk,
assertModuleNotFoundError
)
)
);