Skip to content

Commit 6674c56

Browse files
committed
chore: update snapshot
1 parent dc68c9e commit 6674c56

File tree

15 files changed

+37
-26
lines changed

15 files changed

+37
-26
lines changed

crates/node_binding/src/error.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,10 @@ impl std::fmt::Display for RspackError {
216216
write!(f, "{}", self.message)
217217
}
218218
} else {
219-
if let Some(stack) = &self.stack
220-
&& self.hide_stack != Some(true)
221-
{
222-
write!(f, "{stack}")?;
223-
} else {
224-
write!(f, "{}: ", self.name)?;
225-
write!(f, "{}", &self.message)?;
219+
write!(f, "{}: ", self.name)?;
220+
write!(f, "{}", &self.message)?;
221+
if let Some(details) = &self.details {
222+
write!(f, "\n{details}")?;
226223
}
227224
Ok(())
228225
}

crates/rspack_core/src/normal_module.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ impl Module for NormalModule {
424424
Ok(r) => r.split_into_parts(),
425425
Err(r) => {
426426
let diagnostic = if r.is::<CapturedLoaderError>() {
427+
#[allow(clippy::unwrap_used)]
427428
let mut captured_error = r.downcast::<CapturedLoaderError>().unwrap();
428429
self.build_info.cacheable = captured_error.cacheable;
429430
self.build_info.file_dependencies = captured_error
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
WARNING in ./lib.js
22
⚠ ModuleWarning: Failed to load (from: <TEST_TOOLS_ROOT>/tests/diagnosticsCases/module-build-failed/loader-emit-hide-stack/my-loader.js)
3+
│ at xxx
4+
│ at xxx
5+
│ at xxx
6+
│ at xxx
7+
│ at xxx
8+
│ at xxx
9+
│ at xxx
310

411
ERROR in ./lib.js
5-
× ModuleError: Failed to load (from: <TEST_TOOLS_ROOT>/tests/diagnosticsCases/module-build-failed/loader-emit-hide-stack/my-loader.js)
12+
× ModuleError: Failed to load (from: <TEST_TOOLS_ROOT>/tests/diagnosticsCases/module-build-failed/loader-emit-hide-stack/my-loader.js)
13+
│ at xxx
14+
│ at xxx
15+
│ at xxx
16+
│ at xxx
17+
│ at xxx
18+
│ at xxx
19+
│ at xxx

packages/rspack-test-tools/tests/errorCases/error-test-push.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = {
1919
"errors": Array [
2020
Object {
2121
"code": "Error",
22-
"message": " × Error: test push\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
22+
"message": " × Error: test push\\n",
2323
"moduleTrace": Array [],
2424
"stack": "Error: test push\\n at <TEST_TOOLS_ROOT>/tests/errorCases/error-test-push.js<LINE_COL>\\n at Object.fn (<RSPACK_ROOT>/dist/index.js<LINE_COL>)\\n at next (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsyncStageRange (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsync (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at <RSPACK_ROOT>/dist/index.js<LINE_COL>",
2525
},

packages/rspack-test-tools/tests/errorCases/error-test-set-with-index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = {
2121
"errors": Array [
2222
Object {
2323
"code": "Error",
24-
"message": " × Error: error 1\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
24+
"message": " × Error: error 1\\n",
2525
"moduleTrace": Array [],
2626
"stack": "Error: error 1\\n at <TEST_TOOLS_ROOT>/tests/errorCases/error-test-set-with-index.js<LINE_COL>\\n at Object.fn (<RSPACK_ROOT>/dist/index.js<LINE_COL>)\\n at next (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsyncStageRange (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsync (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at <RSPACK_ROOT>/dist/index.js<LINE_COL>",
2727
},

packages/rspack-test-tools/tests/errorCases/error-test-set.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ module.exports = {
1919
"errors": Array [
2020
Object {
2121
"code": "Error",
22-
"message": " × Error: error 1\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
22+
"message": " × Error: error 1\\n",
2323
"moduleTrace": Array [],
2424
"stack": "Error: error 1\\n at <TEST_TOOLS_ROOT>/tests/errorCases/error-test-set.js<LINE_COL>\\n at Object.fn (<RSPACK_ROOT>/dist/index.js<LINE_COL>)\\n at next (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsyncStageRange (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsync (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at <RSPACK_ROOT>/dist/index.js<LINE_COL>",
2525
},
2626
Object {
2727
"code": "Error",
28-
"message": " × Error: error 2\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
28+
"message": " × Error: error 2\\n",
2929
"moduleTrace": Array [],
3030
"stack": "Error: error 2\\n at <TEST_TOOLS_ROOT>/tests/errorCases/error-test-set.js<LINE_COL>\\n at Object.fn (<RSPACK_ROOT>/dist/index.js<LINE_COL>)\\n at next (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsyncStageRange (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsync (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at <RSPACK_ROOT>/dist/index.js<LINE_COL>",
3131
},

packages/rspack-test-tools/tests/errorCases/error-test-shift.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = {
2323
"errors": Array [
2424
Object {
2525
"code": "Error",
26-
"message": " × Error: test unshift\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
26+
"message": " × Error: test unshift\\n",
2727
"moduleTrace": Array [],
2828
"stack": "Error: test unshift\\n at <TEST_TOOLS_ROOT>/tests/errorCases/error-test-shift.js<LINE_COL>\\n at Object.fn (<RSPACK_ROOT>/dist/index.js<LINE_COL>)\\n at next (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsyncStageRange (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsync (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at <RSPACK_ROOT>/dist/index.js<LINE_COL>",
2929
},

packages/rspack-test-tools/tests/errorCases/error-test-splice-1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = {
1919
"errors": Array [
2020
Object {
2121
"code": "Error",
22-
"message": " × Error: test splice\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
22+
"message": " × Error: test splice\\n",
2323
"moduleTrace": Array [],
2424
"stack": "Error: test splice\\n at <TEST_TOOLS_ROOT>/tests/errorCases/error-test-splice-1.js<LINE_COL>\\n at Object.fn (<RSPACK_ROOT>/dist/index.js<LINE_COL>)\\n at next (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsyncStageRange (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsync (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at <RSPACK_ROOT>/dist/index.js<LINE_COL>",
2525
},

packages/rspack-test-tools/tests/errorCases/error-test-splice-2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = {
1919
"errors": Array [
2020
Object {
2121
"code": "Error",
22-
"message": " × Error: test splice\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
22+
"message": " × Error: test splice\\n",
2323
"moduleTrace": Array [],
2424
"stack": "Error: test splice\\n at <TEST_TOOLS_ROOT>/tests/errorCases/error-test-splice-2.js<LINE_COL>\\n at Object.fn (<RSPACK_ROOT>/dist/index.js<LINE_COL>)\\n at next (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsyncStageRange (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsync (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at <RSPACK_ROOT>/dist/index.js<LINE_COL>",
2525
},

packages/rspack-test-tools/tests/errorCases/warning-test-push.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = {
2020
"warnings": Array [
2121
Object {
2222
"code": "Error",
23-
"message": " ⚠ Error: test push\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
23+
"message": " ⚠ Error: test push\\n",
2424
"moduleTrace": Array [],
2525
"stack": "Error: test push\\n at <TEST_TOOLS_ROOT>/tests/errorCases/warning-test-push.js<LINE_COL>\\n at Object.fn (<RSPACK_ROOT>/dist/index.js<LINE_COL>)\\n at next (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsyncStageRange (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsync (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at <RSPACK_ROOT>/dist/index.js<LINE_COL>",
2626
},

packages/rspack-test-tools/tests/errorCases/warning-test-set.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ module.exports = {
2323
"warnings": Array [
2424
Object {
2525
"code": "Error",
26-
"message": " ⚠ Error: warning 1\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
26+
"message": " ⚠ Error: warning 1\\n",
2727
"moduleTrace": Array [],
2828
"stack": "Error: warning 1\\n at <TEST_TOOLS_ROOT>/tests/errorCases/warning-test-set.js<LINE_COL>\\n at Object.fn (<RSPACK_ROOT>/dist/index.js<LINE_COL>)\\n at next (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsyncStageRange (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsync (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at <RSPACK_ROOT>/dist/index.js<LINE_COL>",
2929
},
3030
Object {
3131
"code": "Error",
32-
"message": " ⚠ Error: warning 2\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
32+
"message": " ⚠ Error: warning 2\\n",
3333
"moduleTrace": Array [],
3434
"stack": "Error: warning 2\\n at <TEST_TOOLS_ROOT>/tests/errorCases/warning-test-set.js<LINE_COL>\\n at Object.fn (<RSPACK_ROOT>/dist/index.js<LINE_COL>)\\n at next (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsyncStageRange (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsync (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at <RSPACK_ROOT>/dist/index.js<LINE_COL>",
3535
},

packages/rspack-test-tools/tests/errorCases/warning-test-shift.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = {
2424
"warnings": Array [
2525
Object {
2626
"code": "Error",
27-
"message": " ⚠ Error: test unshift\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
27+
"message": " ⚠ Error: test unshift\\n",
2828
"moduleTrace": Array [],
2929
"stack": "Error: test unshift\\n at <TEST_TOOLS_ROOT>/tests/errorCases/warning-test-shift.js<LINE_COL>\\n at Object.fn (<RSPACK_ROOT>/dist/index.js<LINE_COL>)\\n at next (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsyncStageRange (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsync (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at <RSPACK_ROOT>/dist/index.js<LINE_COL>",
3030
},

packages/rspack-test-tools/tests/errorCases/warning-test-splice-1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = {
2020
"warnings": Array [
2121
Object {
2222
"code": "Error",
23-
"message": " ⚠ Error: test splice\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
23+
"message": " ⚠ Error: test splice\\n",
2424
"moduleTrace": Array [],
2525
"stack": "Error: test splice\\n at <TEST_TOOLS_ROOT>/tests/errorCases/warning-test-splice-1.js<LINE_COL>\\n at Object.fn (<RSPACK_ROOT>/dist/index.js<LINE_COL>)\\n at next (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsyncStageRange (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsync (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at <RSPACK_ROOT>/dist/index.js<LINE_COL>",
2626
},

packages/rspack-test-tools/tests/errorCases/warning-test-splice-2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = {
2020
"warnings": Array [
2121
Object {
2222
"code": "Error",
23-
"message": " ⚠ Error: test splice\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
23+
"message": " ⚠ Error: test splice\\n",
2424
"moduleTrace": Array [],
2525
"stack": "Error: test splice\\n at <TEST_TOOLS_ROOT>/tests/errorCases/warning-test-splice-2.js<LINE_COL>\\n at Object.fn (<RSPACK_ROOT>/dist/index.js<LINE_COL>)\\n at next (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsyncStageRange (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at AsyncSeriesHook.callAsync (<ROOT>/node_modules/<PNPM_INNER>/@rspack/lite-tapable/dist/index.js<LINE_COL>)\\n at <RSPACK_ROOT>/dist/index.js<LINE_COL>",
2626
},

packages/rspack/src/loader-runner/index.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -581,10 +581,9 @@ export async function runLoaders(
581581
loaderContext.loaders[loaderContext.loaderIndex]
582582
)})`;
583583
(error as RspackError).module = loaderContext._module;
584-
(error as RspackError).details =
585-
stack && (error as RspackError).hideStack
586-
? cleanUp(stack, name, message)
587-
: undefined;
584+
(error as RspackError).details = stack
585+
? cleanUp(stack, name, message)
586+
: undefined;
588587
compiler._lastCompilation!.__internal__pushRspackDiagnostic({
589588
error,
590589
severity: JsRspackSeverity.Error
@@ -1111,7 +1110,7 @@ export async function runLoaders(
11111110
} catch (e) {
11121111
if (typeof e !== "object" || e === null) {
11131112
const error = new Error(
1114-
"(Emitted value instead of an instance of Error) " + e
1113+
`(Emitted value instead of an instance of Error) ${e}`
11151114
);
11161115
error.name = "NonErrorEmittedError";
11171116
context.__internal__error = error;

0 commit comments

Comments
 (0)