@ -132,7 +132,7 @@ it("should emit warning for missingFile", async () => {
entry : "./missingFile"
} )
) . resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"loc" : "4:0-20" ,
@ -141,6 +141,7 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/missingFile.js" ,
"moduleName" : "./missingFile.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleNotFoundError: Module not found: Error: Can't resolve './missing' in '<cwd>/test/fixtures/errors'" ,
} ,
Object {
"loc" : "12:9-34" ,
@ -149,17 +150,18 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/missingFile.js" ,
"moduleName" : "./missingFile.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleNotFoundError: Module not found: Error: Can't resolve './dir/missing2' in '<cwd>/test/fixtures/errors'" ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
it ( "should emit warning for require.extensions" , async ( ) => {
await expect ( compile ( { entry : "./require.extensions" } ) ) . resolves
. toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [ ] ,
"warnings" : Array [
Object {
@ -169,16 +171,17 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/require.extensions.js" ,
"moduleName" : "./require.extensions.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "UnsupportedFeatureWarning: require.extensions is not supported by webpack. Use a loader instead." ,
} ,
] ,
}
` );
}
` );
} ) ;
it ( "should emit warning for require.main.require" , async ( ) => {
await expect ( compile ( { entry : "./require.main.require" } ) ) . resolves
. toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [ ] ,
"warnings" : Array [
Object {
@ -188,15 +191,16 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/require.main.require.js" ,
"moduleName" : "./require.main.require.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "UnsupportedFeatureWarning: require.main.require is not supported by webpack." ,
} ,
] ,
}
` );
}
` );
} ) ;
it ( "should emit warning for module.parent.require" , async ( ) => {
await expect ( compile ( { entry : "./module.parent.require" } ) ) . resolves
. toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [ ] ,
"warnings" : Array [
Object {
@ -206,10 +210,11 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/module.parent.require.js" ,
"moduleName" : "./module.parent.require.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "UnsupportedFeatureWarning: module.parent.require is not supported by webpack." ,
} ,
] ,
}
` );
}
` );
} ) ;
const isCaseInsensitiveFilesystem = fs . existsSync (
@ -222,7 +227,7 @@ if (isCaseInsensitiveFilesystem) {
entry : "./case-sensitive"
} ) ;
expect ( result ) . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [ ] ,
"warnings" : Array [
Object {
@ -245,10 +250,11 @@ Object {
"originName" : "./case-sensitive.js" ,
} ,
] ,
"stack" : "CaseSensitiveModulesWarning: There are multiple modules with names that only differ in casing.\\nThis can lead to unexpected behavior when compiling on a filesystem with other case-semantic.\\nUse equal casing. Compare these module identifiers:\\n* <cwd>/test/fixtures/errors/FILE.js\\n Used by 1 module(s), i. e.\\n <cwd>/test/fixtures/errors/case-sensitive.js\\n* <cwd>/test/fixtures/errors/file.js\\n Used by 1 module(s), i. e.\\n <cwd>/test/fixtures/errors/case-sensitive.js" ,
} ,
] ,
}
` );
}
` );
} ) ;
} else {
it ( "should emit error for case-sensitive" , async ( ) => {
@ -257,7 +263,7 @@ Object {
entry : "./case-sensitive"
} ) ;
expect ( result ) . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"loc" : "2:0-17" ,
@ -266,41 +272,43 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/case-sensitive.js" ,
"moduleName" : "./case-sensitive.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleNotFoundError: Module not found: Error: Can't resolve './FILE' in '<cwd>/test/fixtures/errors'" ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
}
it ( "should emit warning for undef mode" , async ( ) => {
await expect ( compile ( { mode : undefined , entry : "./entry-point" } ) ) . resolves
. toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [ ] ,
"warnings" : Array [
Object {
"message" : "configuration\\nThe 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.\\nYou can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/" ,
"stack" : "NoModeWarning: configuration\\nThe 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.\\nYou can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/" ,
} ,
] ,
}
` );
}
` );
} ) ;
it ( "should emit no errors or warnings for no-errors-deprecate" , async ( ) => {
await expect ( compile ( { mode : "production" , entry : "./no-errors-deprecate" } ) )
. resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [ ] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
it ( "should emit errors for missingFile for production" , async ( ) => {
await expect ( compile ( { mode : "production" , entry : "./missingFile" } ) ) . resolves
. toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"loc" : "4:0-20" ,
@ -309,6 +317,7 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/missingFile.js" ,
"moduleName" : "./missingFile.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleNotFoundError: Module not found: Error: Can't resolve './missing' in '<cwd>/test/fixtures/errors'" ,
} ,
Object {
"loc" : "12:9-34" ,
@ -317,17 +326,18 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/missingFile.js" ,
"moduleName" : "./missingFile.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleNotFoundError: Module not found: Error: Can't resolve './dir/missing2' in '<cwd>/test/fixtures/errors'" ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
it ( "should emit module build errors" , async ( ) => {
await expect ( compile ( { entry : "./has-syntax-error" } ) ) . resolves
. toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"loc" : "2:12" ,
@ -336,11 +346,12 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/has-syntax-error.js" ,
"moduleName" : "./has-syntax-error.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleParseError: Module parse failed: Unexpected token (2:12)\\nYou may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders\\n| window.foo = {\\n> bar: true,;\\n| };\\n| " ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
it ( "should bao; thrown sync error from plugin" , async ( ) => {
@ -350,11 +361,11 @@ it("should bao; thrown sync error from plugin", async () => {
plugins : [ require ( "./fixtures/errors/throw-error-plugin" ) ]
} )
) . rejects . toMatchInlineSnapshot ( `
Object {
Object {
"message" : "foo" ,
"stack" : "Error: foo" ,
}
` );
}
` );
} ) ;
describe ( "loaders" , ( ) => {
@ -364,7 +375,7 @@ describe("loaders", () => {
entry : "./module-level-throw-error-loader!./no-errors-deprecate"
} )
) . resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"message" : "Module build failed (from ./module-level-throw-error-loader.js):\\nError: this is a thrown error from module level" ,
@ -372,16 +383,17 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/module-level-throw-error-loader.js!<cwd>/test/fixtures/errors/no-errors-deprecate.js" ,
"moduleName" : "./module-level-throw-error-loader.js!./no-errors-deprecate.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleBuildError: Module build failed (from ./module-level-throw-error-loader.js):\\nError: this is a thrown error from module level" ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
it ( "should emit errors & warnings for emit-error-loader" , async ( ) => {
await expect ( compile ( { entry : "./entry-point-error-loader-required.js" } ) )
. resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"message" : "Module Error (from ./emit-error-loader.js):\\nthis is an error" ,
@ -403,6 +415,7 @@ Object {
"originName" : "./entry-point-error-loader-required.js" ,
} ,
] ,
"stack" : "ModuleError: Module Error (from ./emit-error-loader.js):\\nthis is an error" ,
} ,
] ,
"warnings" : Array [
@ -426,16 +439,17 @@ Object {
"originName" : "./entry-point-error-loader-required.js" ,
} ,
] ,
"stack" : "ModuleWarning: Module Warning (from ./emit-error-loader.js):\\nthis is a warning" ,
} ,
] ,
}
` );
}
` );
} ) ;
it ( "should emit error & warning for emit-error-loader" , async ( ) => {
await expect ( compile ( { entry : "./emit-error-loader!./entry-point.js" } ) )
. resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"message" : "Module Error (from ./emit-error-loader.js):\\nthis is an error" ,
@ -443,6 +457,7 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/emit-error-loader.js!<cwd>/test/fixtures/errors/entry-point.js" ,
"moduleName" : "./emit-error-loader.js!./entry-point.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleError: Module Error (from ./emit-error-loader.js):\\nthis is an error" ,
} ,
] ,
"warnings" : Array [
@ -452,15 +467,16 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/emit-error-loader.js!<cwd>/test/fixtures/errors/entry-point.js" ,
"moduleName" : "./emit-error-loader.js!./entry-point.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleWarning: Module Warning (from ./emit-error-loader.js):\\nthis is a warning" ,
} ,
] ,
}
` );
}
` );
} ) ;
it ( "should emit error for json-loader when not json" , async ( ) => {
await expect ( compile ( { entry : "json-loader!./not-a-json.js" } ) ) . resolves
. toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"message" : "Module build failed (from (webpack)/node_modules/json-loader/index.js):\\nSyntaxError: Unexpected end of JSON input" ,
@ -468,17 +484,18 @@ Object {
"moduleIdentifier" : "<cwd>/node_modules/json-loader/index.js!<cwd>/test/fixtures/errors/not-a-json.js" ,
"moduleName" : "(webpack)/node_modules/json-loader!./not-a-json.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleBuildError: Module build failed (from (webpack)/node_modules/json-loader/index.js):\\nSyntaxError: Unexpected end of JSON input" ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
it ( "should emit error for async-error-loader" , async ( ) => {
await expect ( compile ( { entry : "./async-error-loader!./entry-point.js" } ) )
. resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"message" : "Module build failed (from ./async-error-loader.js):\\nError: this is a callback error" ,
@ -486,17 +503,18 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/async-error-loader.js!<cwd>/test/fixtures/errors/entry-point.js" ,
"moduleName" : "./async-error-loader.js!./entry-point.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleBuildError: Module build failed (from ./async-error-loader.js):\\nError: this is a callback error" ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
it ( "should emit error thrown from raw loader" , async ( ) => {
await expect ( compile ( { entry : "./throw-error-loader!./entry-point.js" } ) )
. resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"message" : "Module build failed (from ./throw-error-loader.js):\\nError: this is a thrown error" ,
@ -504,17 +522,18 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/throw-error-loader.js!<cwd>/test/fixtures/errors/entry-point.js" ,
"moduleName" : "./throw-error-loader.js!./entry-point.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleBuildError: Module build failed (from ./throw-error-loader.js):\\nError: this is a thrown error" ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
it ( "should emit error thrown from pitch loader" , async ( ) => {
await expect ( compile ( { entry : "./throw-error-loader!./entry-point.js" } ) )
. resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"message" : "Module build failed (from ./throw-error-loader.js):\\nError: this is a thrown error" ,
@ -522,16 +541,17 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/throw-error-loader.js!<cwd>/test/fixtures/errors/entry-point.js" ,
"moduleName" : "./throw-error-loader.js!./entry-point.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleBuildError: Module build failed (from ./throw-error-loader.js):\\nError: this is a thrown error" ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
it ( "should emit error thrown from yaw loader" , async ( ) => {
await expect ( compile ( { entry : "./throw-error-loader!./entry-point.js" } ) )
. resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"message" : "Module build failed (from ./throw-error-loader.js):\\nError: this is a thrown error" ,
@ -539,18 +559,19 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/throw-error-loader.js!<cwd>/test/fixtures/errors/entry-point.js" ,
"moduleName" : "./throw-error-loader.js!./entry-point.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleBuildError: Module build failed (from ./throw-error-loader.js):\\nError: this is a thrown error" ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
it ( "should emit errors & warnings for irregular-error-loader" , async ( ) => {
await expect (
compile ( { entry : "./irregular-error-loader!./entry-point.js" } )
) . resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"message" : "Module Error (from ./irregular-error-loader.js):\\n(Emitted value instead of an instance of Error) null" ,
@ -558,6 +579,7 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/irregular-error-loader.js!<cwd>/test/fixtures/errors/entry-point.js" ,
"moduleName" : "./irregular-error-loader.js!./entry-point.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleError: Module Error (from ./irregular-error-loader.js):\\n(Emitted value instead of an instance of Error) null" ,
} ,
Object {
"message" : "Module Error (from ./irregular-error-loader.js):\\nError" ,
@ -565,6 +587,7 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/irregular-error-loader.js!<cwd>/test/fixtures/errors/entry-point.js" ,
"moduleName" : "./irregular-error-loader.js!./entry-point.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleError: Module Error (from ./irregular-error-loader.js):\\nError" ,
} ,
Object {
"message" : "Module build failed (from ./irregular-error-loader.js):\\nNonErrorEmittedError: (Emitted value instead of an instance of Error) a string error" ,
@ -572,6 +595,7 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/irregular-error-loader.js!<cwd>/test/fixtures/errors/entry-point.js" ,
"moduleName" : "./irregular-error-loader.js!./entry-point.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleBuildError: Module build failed (from ./irregular-error-loader.js):\\nNonErrorEmittedError: (Emitted value instead of an instance of Error) a string error" ,
} ,
] ,
"warnings" : Array [
@ -581,6 +605,7 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/irregular-error-loader.js!<cwd>/test/fixtures/errors/entry-point.js" ,
"moduleName" : "./irregular-error-loader.js!./entry-point.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleWarning: Module Warning (from ./irregular-error-loader.js):\\n(Emitted value instead of an instance of Error) null" ,
} ,
Object {
"message" : "Module Warning (from ./irregular-error-loader.js):\\nError" ,
@ -588,16 +613,17 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/irregular-error-loader.js!<cwd>/test/fixtures/errors/entry-point.js" ,
"moduleName" : "./irregular-error-loader.js!./entry-point.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleWarning: Module Warning (from ./irregular-error-loader.js):\\nError" ,
} ,
] ,
}
` );
}
` );
} ) ;
it ( "should emit error for no-return-loader" , async ( ) => {
await expect ( compile ( { entry : "./no-return-loader!./entry-point.js" } ) )
. resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"message" : "Module build failed: Error: Final loader (./no-return-loader.js) didn't return a Buffer or String" ,
@ -605,33 +631,35 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/no-return-loader.js!<cwd>/test/fixtures/errors/entry-point.js" ,
"moduleName" : "./no-return-loader.js!./entry-point.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleBuildError: Module build failed: Error: Final loader (./no-return-loader.js) didn't return a Buffer or String" ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
it ( "should emit error for doesnt-exist-loader" , async ( ) => {
await expect ( compile ( { entry : "./doesnt-exist-loader!./entry-point.js" } ) )
. resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"loc" : "main" ,
"message" : "Module not found: Error: Can't resolve './doesnt-exist-loader' in '<cwd>/test/fixtures/errors'" ,
"stack" : "ModuleNotFoundError: Module not found: Error: Can't resolve './doesnt-exist-loader' in '<cwd>/test/fixtures/errors'" ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
it ( "should emit error for return-undefined-loader" , async ( ) => {
await expect (
compile ( { entry : "./return-undefined-loader!./entry-point.js" } )
) . resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"message" : "Module build failed: Error: Final loader (./return-undefined-loader.js) didn't return a Buffer or String" ,
@ -639,18 +667,19 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/return-undefined-loader.js!<cwd>/test/fixtures/errors/entry-point.js" ,
"moduleName" : "./return-undefined-loader.js!./entry-point.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleBuildError: Module build failed: Error: Final loader (./return-undefined-loader.js) didn't return a Buffer or String" ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
it ( "should emit error for module-exports-object-loader" , async ( ) => {
await expect (
compile ( { entry : "./module-exports-object-loader!./entry-point.js" } )
) . resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"message" : "Module build failed (from ./module-exports-object-loader.js):\\nLoaderRunnerError: Module '<cwd>/test/fixtures/errors/module-exports-object-loader.js' is not a loader (must have normal or pitch function)" ,
@ -658,18 +687,19 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/module-exports-object-loader.js!<cwd>/test/fixtures/errors/entry-point.js" ,
"moduleName" : "./module-exports-object-loader.js!./entry-point.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleBuildError: Module build failed (from ./module-exports-object-loader.js):\\nLoaderRunnerError: Module '<cwd>/test/fixtures/errors/module-exports-object-loader.js' is not a loader (must have normal or pitch function)" ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
it ( "should emit error for module-exports-string-loader" , async ( ) => {
await expect (
compile ( { entry : "./module-exports-string-loader!./entry-point.js" } )
) . resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"message" : "Module build failed (from ./module-exports-string-loader.js):\\nLoaderRunnerError: Module '<cwd>/test/fixtures/errors/module-exports-string-loader.js' is not a loader (export function or es6 module)" ,
@ -677,11 +707,12 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/module-exports-string-loader.js!<cwd>/test/fixtures/errors/entry-point.js" ,
"moduleName" : "./module-exports-string-loader.js!./entry-point.js" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleBuildError: Module build failed (from ./module-exports-string-loader.js):\\nLoaderRunnerError: Module '<cwd>/test/fixtures/errors/module-exports-string-loader.js' is not a loader (export function or es6 module)" ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
const identityLoader = path . resolve (
@ -708,7 +739,7 @@ Object {
}
} )
) . resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"loc" : "1:0" ,
@ -717,11 +748,12 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/identity-loader.js!<cwd>/test/fixtures/errors/abc.html" ,
"moduleName" : "./abc.html" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleParseError: Module parse failed: Unexpected token (1:0)\\nFile was processed with these loaders:\\n * ./identity-loader.js\\nYou may need an additional loader to handle the result of these loaders.\\n> <!DOCTYPE html>\\n| <html>\\n| <body>" ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
it ( "should show all loaders used if they are in config when module parsing fails" , async ( ) => {
@ -739,7 +771,7 @@ Object {
}
} )
) . resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"loc" : "1:0" ,
@ -748,11 +780,12 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/identity-loader.js!<cwd>/test/fixtures/errors/add-comment-loader.js!<cwd>/test/fixtures/errors/abc.html" ,
"moduleName" : "./abc.html" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleParseError: Module parse failed: Unexpected token (1:0)\\nFile was processed with these loaders:\\n * ./identity-loader.js\\n * ./add-comment-loader.js\\nYou may need an additional loader to handle the result of these loaders.\\n> <!DOCTYPE html>\\n| <html>\\n| <body>" ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
it ( "should show all loaders used if use is a string" , async ( ) => {
@ -768,7 +801,7 @@ Object {
}
} )
) . resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"loc" : "1:0" ,
@ -777,11 +810,12 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/identity-loader.js!<cwd>/test/fixtures/errors/add-comment-loader.js!<cwd>/test/fixtures/errors/abc.html" ,
"moduleName" : "./abc.html" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleParseError: Module parse failed: Unexpected token (1:0)\\nFile was processed with these loaders:\\n * ./identity-loader.js\\n * ./add-comment-loader.js\\nYou may need an additional loader to handle the result of these loaders.\\n> <!DOCTYPE html>\\n| <html>\\n| <body>" ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
it ( "should show 'no loaders are configured to process this file' if loaders are not included in config when module parsing fails" , async ( ) => {
@ -792,7 +826,7 @@ Object {
module : { }
} )
) . resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"loc" : "1:0" ,
@ -801,11 +835,12 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/errors/abc.html" ,
"moduleName" : "./abc.html" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleParseError: Module parse failed: Unexpected token (1:0)\\nYou may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders\\n> <!DOCTYPE html>\\n| <html>\\n| <body>" ,
} ,
] ,
"warnings" : Array [ ] ,
}
` );
}
` );
} ) ;
it ( "should show 'source code omitted for this binary file' when module parsing fails for binary files" , async ( ) => {
@ -817,7 +852,7 @@ Object {
module : { }
} )
) . resolves . toMatchInlineSnapshot ( `
Object {
Object {
"errors" : Array [
Object {
"loc" : "1:0" ,
@ -826,10 +861,11 @@ Object {
"moduleIdentifier" : "<cwd>/test/fixtures/font.ttf" ,
"moduleName" : "../font.ttf" ,
"moduleTrace" : Array [ ] ,
"stack" : "ModuleParseError: Module parse failed: Unexpected character '