-
-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: should provide full error message with error name when `hideStac…
…k` is set to `true` (#7867) * fix: init * fix
- Loading branch information
Showing
18 changed files
with
141 additions
and
6 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
...s/rspack-test-tools/tests/diagnosticsCases/module-build-failed/loader-emit-error/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
it("should include loader thrown error", () => { | ||
let errored = false; | ||
try { | ||
require("./lib"); | ||
} catch (e) { | ||
errored = true; | ||
expect(e.message).toContain("Failed to load"); | ||
} | ||
expect(errored).toBeTruthy() | ||
}); |
1 change: 1 addition & 0 deletions
1
...ges/rspack-test-tools/tests/diagnosticsCases/module-build-failed/loader-emit-error/lib.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const lib = "lib"; |
4 changes: 4 additions & 0 deletions
4
...pack-test-tools/tests/diagnosticsCases/module-build-failed/loader-emit-error/my-loader.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = function (context) { | ||
this.emitError(new Error("Failed to load")); | ||
return "" | ||
}; |
18 changes: 18 additions & 0 deletions
18
...-test-tools/tests/diagnosticsCases/module-build-failed/loader-emit-error/rspack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* @type {import('@rspack/core').RspackOptions} | ||
*/ | ||
module.exports = { | ||
context: __dirname, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /lib\.js$/, | ||
use: [ | ||
{ | ||
loader: "./my-loader.js" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}; |
9 changes: 9 additions & 0 deletions
9
.../rspack-test-tools/tests/diagnosticsCases/module-build-failed/loader-emit-error/stats.err
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
ERROR in ./lib.js | ||
× ModuleError: Failed to load (from: <PROJECT_ROOT>/tests/diagnosticsCases/module-build-failed/loader-emit-error/my-loader.js) | ||
│ at xxx | ||
│ at xxx | ||
│ at xxx | ||
│ at xxx | ||
│ at xxx | ||
│ at xxx | ||
│ at xxx |
10 changes: 10 additions & 0 deletions
10
...ack-test-tools/tests/diagnosticsCases/module-build-failed/loader-emit-hide-stack/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
it("should include loader thrown error", () => { | ||
let errored = false; | ||
try { | ||
require("./lib"); | ||
} catch (e) { | ||
errored = true; | ||
expect(e.message).toContain("Failed to load"); | ||
} | ||
expect(errored).toBeTruthy() | ||
}); |
1 change: 1 addition & 0 deletions
1
...spack-test-tools/tests/diagnosticsCases/module-build-failed/loader-emit-hide-stack/lib.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const lib = "lib"; |
11 changes: 11 additions & 0 deletions
11
...test-tools/tests/diagnosticsCases/module-build-failed/loader-emit-hide-stack/my-loader.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = function (context) { | ||
let e; | ||
e = new Error("Failed to load"); | ||
e.hideStack = true; | ||
this.emitError(e); | ||
|
||
e = new Error("Failed to load"); | ||
e.hideStack = true; | ||
this.emitWarning(e); | ||
return "" | ||
}; |
18 changes: 18 additions & 0 deletions
18
...-tools/tests/diagnosticsCases/module-build-failed/loader-emit-hide-stack/rspack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* @type {import('@rspack/core').RspackOptions} | ||
*/ | ||
module.exports = { | ||
context: __dirname, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /lib\.js$/, | ||
use: [ | ||
{ | ||
loader: "./my-loader.js" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}; |
5 changes: 5 additions & 0 deletions
5
...ck-test-tools/tests/diagnosticsCases/module-build-failed/loader-emit-hide-stack/stats.err
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
WARNING in ./lib.js | ||
⚠ ModuleWarning: Failed to load (from: <PROJECT_ROOT>/tests/diagnosticsCases/module-build-failed/loader-emit-hide-stack/my-loader.js) | ||
|
||
ERROR in ./lib.js | ||
× ModuleError: Failed to load (from: <PROJECT_ROOT>/tests/diagnosticsCases/module-build-failed/loader-emit-hide-stack/my-loader.js) |
10 changes: 10 additions & 0 deletions
10
...rspack-test-tools/tests/diagnosticsCases/module-build-failed/loader-emit-warning/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
it("should include loader thrown error", () => { | ||
let errored = false; | ||
try { | ||
require("./lib"); | ||
} catch (e) { | ||
errored = true; | ||
expect(e.message).toContain("Failed to load"); | ||
} | ||
expect(errored).toBeTruthy() | ||
}); |
1 change: 1 addition & 0 deletions
1
...s/rspack-test-tools/tests/diagnosticsCases/module-build-failed/loader-emit-warning/lib.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const lib = "lib"; |
4 changes: 4 additions & 0 deletions
4
...ck-test-tools/tests/diagnosticsCases/module-build-failed/loader-emit-warning/my-loader.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = function (context) { | ||
this.emitWarning(new Error("Failed to load")); | ||
return "" | ||
}; |
18 changes: 18 additions & 0 deletions
18
...est-tools/tests/diagnosticsCases/module-build-failed/loader-emit-warning/rspack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* @type {import('@rspack/core').RspackOptions} | ||
*/ | ||
module.exports = { | ||
context: __dirname, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /lib\.js$/, | ||
use: [ | ||
{ | ||
loader: "./my-loader.js" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}; |
9 changes: 9 additions & 0 deletions
9
...spack-test-tools/tests/diagnosticsCases/module-build-failed/loader-emit-warning/stats.err
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
WARNING in ./lib.js | ||
⚠ ModuleWarning: Failed to load (from: <PROJECT_ROOT>/tests/diagnosticsCases/module-build-failed/loader-emit-warning/my-loader.js) | ||
│ at xxx | ||
│ at xxx | ||
│ at xxx | ||
│ at xxx | ||
│ at xxx | ||
│ at xxx | ||
│ at xxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fa38b86
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Benchmark detail: Open
fa38b86
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Ran ecosystem CI: Open