1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 07:44:48 -05:00
denoland-deno/cli/tests
Nayeem Rahman 806671af33
fix(core): preserve syntax error locations in dynamic imports (#18664)
Fixes #6259.

Adds the location for v8 syntax errors to the message (`message += " at
{location}"`) when rethrowing them for dynamic imports.

Discussing with @bartlomieju on discord I proposed just preserving v8's
error and not reconstructing it, allowing the standard stack trace to
just point to the syntax error instead of the dynamic import. But on
further thought this way has parity with SWC's syntax errors + has the
advantage of showing both the syntax error and dynamic import location.

```ts
// temp.js
await import("./temp2.js");

// temp2.js
function foo() {
  await Promise.resolve();
}

// Before:
// error: Uncaught (in promise) SyntaxError: Unexpected reserved word
// await import("./temp2.js");
// ^
//     at async file:///.../temp.js:1:1

// After:
// error: Uncaught (in promise) SyntaxError: Unexpected reserved word at file:///.../temp2.js:2:3
// await import("./temp2.js");
// ^
//     at async file:///.../temp.js:1:1
```
2023-04-12 13:45:36 +02:00
..
integration fix(core): preserve syntax error locations in dynamic imports (#18664) 2023-04-12 13:45:36 +02:00
node_compat fix(ext/node): add X509Certificate (#18625) 2023-04-07 22:54:16 +05:30
testdata fix(core): preserve syntax error locations in dynamic imports (#18664) 2023-04-12 13:45:36 +02:00
unit fix(ext/cache): cache.put overwrites previous call (#18649) 2023-04-12 11:25:19 +05:30
unit_node refactor(node/crypto): port polyfill to Rust for randomInt, randomFill, randomFillSync (#18658) 2023-04-12 02:57:57 +02:00
integration_tests.rs tests: move integration tests to a single module (#17380) 2023-01-13 02:59:13 +01:00