Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: unresolved #1122

Merged
merged 1 commit into from
Jul 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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