Skip to content

Commit

Permalink
test: unresolved (#1122)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi authored Jul 22, 2020
1 parent d2f6bd2 commit 58b4b98
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions test/__snapshots__/import-option.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`"import" option should emit warning when unresolved import: errors 1`] = `
Array [
"ModuleBuildError: Module build failed (from \`replaced original path\`):
Error: Can't resolve 'unresolved-file.css' in '/test/fixtures/import'",
]
`;

exports[`"import" option should emit warning when unresolved import: warnings 1`] = `Array []`;

exports[`"import" option should keep original order: errors 1`] = `Array []`;

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

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

exports[`"import" option should throw an error on unresolved import: errors 1`] = `
Array [
"ModuleBuildError: Module build failed (from \`replaced original path\`):
Error: Can't resolve 'unresolved-file.css' in '/test/fixtures/import'",
]
`;

exports[`"import" option should throw an error on unresolved import: warnings 1`] = `Array []`;

exports[`"import" option should work resolve order: local -> node_modules -> alias: errors 1`] = `Array []`;

exports[`"import" option should work resolve order: local -> node_modules -> alias: module 1`] = `
Expand Down
6 changes: 3 additions & 3 deletions test/__snapshots__/modules-option.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1433,14 +1433,14 @@ a {
exports[`"modules" option should support resolving in composes: warnings 1`] = `Array []`;
exports[`"modules" option should throw error when unresolved import: errors 1`] = `
exports[`"modules" option should throw an error on unresolved import: errors 1`] = `
Array [
"ModuleBuildError: Module build failed (from \`replaced original path\`):
Error: Can't resolve './//exammple.com/unresolved.css' in '/test/fixtures/modules/unresolved'",
Error: Can't resolve './unresolved.css' in '/test/fixtures/modules/unresolved'",
]
`;
exports[`"modules" option should throw error when unresolved import: warnings 1`] = `Array []`;
exports[`"modules" option should throw an error on unresolved import: warnings 1`] = `Array []`;
exports[`"modules" option should work and correctly replace escaped symbols: errors 1`] = `Array []`;
Expand Down
4 changes: 2 additions & 2 deletions test/__snapshots__/url-option.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/modules/unresolved/source.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@value foo from '//exammple.com/unresolved.css';
@value foo from './unresolved.css';

.className {
color: foo;
Expand Down
2 changes: 1 addition & 1 deletion test/import-option.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ describe('"import" option', () => {
expect(getErrors(stats)).toMatchSnapshot('errors');
});

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

Expand Down
2 changes: 1 addition & 1 deletion test/modules-option.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ describe('"modules" option', () => {
expect(getErrors(stats)).toMatchSnapshot('errors');
});

it('should throw error when unresolved import', async () => {
it('should throw an error on unresolved import', async () => {
const compiler = getCompiler('./modules/unresolved/source.js', {
modules: true,
});
Expand Down
2 changes: 1 addition & 1 deletion test/url-option.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('"url" option', () => {
expect(getErrors(stats)).toMatchSnapshot('errors');
});

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

Expand Down

0 comments on commit 58b4b98

Please sign in to comment.