Skip to content

Commit 58b4b98

Browse files
test: unresolved (#1122)
1 parent d2f6bd2 commit 58b4b98

7 files changed

+18
-18
lines changed

test/__snapshots__/import-option.test.js.snap

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`"import" option should emit warning when unresolved import: errors 1`] = `
4-
Array [
5-
"ModuleBuildError: Module build failed (from \`replaced original path\`):
6-
Error: Can't resolve 'unresolved-file.css' in '/test/fixtures/import'",
7-
]
8-
`;
9-
10-
exports[`"import" option should emit warning when unresolved import: warnings 1`] = `Array []`;
11-
123
exports[`"import" option should keep original order: errors 1`] = `Array []`;
134

145
exports[`"import" option should keep original order: module 1`] = `
@@ -278,6 +269,15 @@ Array [
278269

279270
exports[`"import" option should respect style field in package.json: warnings 1`] = `Array []`;
280271

272+
exports[`"import" option should throw an error on unresolved import: errors 1`] = `
273+
Array [
274+
"ModuleBuildError: Module build failed (from \`replaced original path\`):
275+
Error: Can't resolve 'unresolved-file.css' in '/test/fixtures/import'",
276+
]
277+
`;
278+
279+
exports[`"import" option should throw an error on unresolved import: warnings 1`] = `Array []`;
280+
281281
exports[`"import" option should work resolve order: local -> node_modules -> alias: errors 1`] = `Array []`;
282282

283283
exports[`"import" option should work resolve order: local -> node_modules -> alias: module 1`] = `

test/__snapshots__/modules-option.test.js.snap

+3-3
Original file line numberDiff line numberDiff line change
@@ -1433,14 +1433,14 @@ a {
14331433
14341434
exports[`"modules" option should support resolving in composes: warnings 1`] = `Array []`;
14351435
1436-
exports[`"modules" option should throw error when unresolved import: errors 1`] = `
1436+
exports[`"modules" option should throw an error on unresolved import: errors 1`] = `
14371437
Array [
14381438
"ModuleBuildError: Module build failed (from \`replaced original path\`):
1439-
Error: Can't resolve './//exammple.com/unresolved.css' in '/test/fixtures/modules/unresolved'",
1439+
Error: Can't resolve './unresolved.css' in '/test/fixtures/modules/unresolved'",
14401440
]
14411441
`;
14421442
1443-
exports[`"modules" option should throw error when unresolved import: warnings 1`] = `Array []`;
1443+
exports[`"modules" option should throw an error on unresolved import: warnings 1`] = `Array []`;
14441444
14451445
exports[`"modules" option should work and correctly replace escaped symbols: errors 1`] = `Array []`;
14461446

test/__snapshots__/url-option.test.js.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`"url" option should emit warning when unresolved import: errors 1`] = `
3+
exports[`"url" option should throw an error on unresolved import: errors 1`] = `
44
Array [
55
"ModuleBuildError: Module build failed (from \`replaced original path\`):
66
Error: Can't resolve 'unresolved.png' in '/test/fixtures/url'",
77
]
88
`;
99

10-
exports[`"url" option should emit warning when unresolved import: warnings 1`] = `Array []`;
10+
exports[`"url" option should throw an error on unresolved import: warnings 1`] = `Array []`;
1111

1212
exports[`"url" option should work when not specified: errors 1`] = `Array []`;
1313

test/fixtures/modules/unresolved/source.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@value foo from '//exammple.com/unresolved.css';
1+
@value foo from './unresolved.css';
22

33
.className {
44
color: foo;

test/import-option.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ describe('"import" option', () => {
143143
expect(getErrors(stats)).toMatchSnapshot('errors');
144144
});
145145

146-
it('should emit warning when unresolved import', async () => {
146+
it('should throw an error on unresolved import', async () => {
147147
const compiler = getCompiler('./import/unresolved.js');
148148
const stats = await compile(compiler);
149149

test/modules-option.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ describe('"modules" option', () => {
830830
expect(getErrors(stats)).toMatchSnapshot('errors');
831831
});
832832

833-
it('should throw error when unresolved import', async () => {
833+
it('should throw an error on unresolved import', async () => {
834834
const compiler = getCompiler('./modules/unresolved/source.js', {
835835
modules: true,
836836
});

test/url-option.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ describe('"url" option', () => {
6767
expect(getErrors(stats)).toMatchSnapshot('errors');
6868
});
6969

70-
it('should emit warning when unresolved import', async () => {
70+
it('should throw an error on unresolved import', async () => {
7171
const compiler = getCompiler('./url/url-unresolved.js');
7272
const stats = await compile(compiler);
7373

0 commit comments

Comments
 (0)