Skip to content

Commit

Permalink
test: migrate message source map tests from Python to JS
Browse files Browse the repository at this point in the history
Migrate the remaining source map tests in the `test/message` folder
from Python to JS.

Fixes: nodejs/node#47707

test: migrate message source map tests from Python to JS
PR-URL: nodejs/node#49238
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
  • Loading branch information
sercher committed Apr 25, 2024
1 parent 6ab26ca commit 9c2c96a
Show file tree
Hide file tree
Showing 20 changed files with 65 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Flags: --enable-source-maps

'use strict';
require('../../../common');
Error.stackTraceLimit = 5;

require('../enclosing-call-site-min.js');
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
throw err
^


Error: an error!
at functionD (*enclosing-call-site.js:16:17)
at functionC (*enclosing-call-site.js:10:3)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Flags: --enable-source-maps

'use strict';
require('../common');
require('../../../common');
Error.stackTraceLimit = 2;

require('../fixtures/source-map/tabs.js');
require('../tabs.js');
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*tabs.coffee:26
alert "I knew it!"
^


ReferenceError: alert is not defined
at Object.<anonymous> (*tabs.coffee:26:2)
at Object.<anonymous> (*tabs.coffee:1:14)

Node.js *
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Flags: --enable-source-maps

'use strict';
require('../common');
require('../../../common');
Error.stackTraceLimit = 2;

try {
require('../fixtures/source-map/typescript-sourcemapping_url_string');
require('../typescript-sourcemapping_url_string');
} catch (err) {
setTimeout(() => {
console.info(err);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Error: an exception.
at Object.<anonymous> (*typescript-sourcemapping_url_string.ts:3:7)
*
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Flags: --enable-source-maps

'use strict';
require('../common');
require('../../../common');
Error.stackTraceLimit = 2;

try {
require('../fixtures/source-map/typescript-throw');
require('../typescript-throw');
} catch (err) {
setTimeout(() => {
console.info(err);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
reachable
Error: an exception
at branch (*typescript-throw.ts:18:11)
at Object.<anonymous> (*typescript-throw.ts:24:1)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Flags: --enable-source-maps

'use strict';
require('../common');
require('../../../common');
Error.stackTraceLimit = 2;

require('../fixtures/source-map/icu');
require('../icu');
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*icu.jsx:3
("あ 🐕 🐕", throw Error("an error"));
^


Error: an error
at Object.createElement (*icu.jsx:3:23)
at Object.<anonymous> (*icu.jsx:9:5)

Node.js *
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Flags: --enable-source-maps

'use strict';
require('../../../common');
require('../uglify-throw');
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*uglify-throw-original.js:5
throw Error('goodbye');
^


Error: goodbye
at Hello (*uglify-throw-original.js:5:9)
at Immediate.<anonymous> (*uglify-throw-original.js:9:3)
at process.processImmediate (node:internal*timers:476:21)

Node.js *
7 changes: 0 additions & 7 deletions graal-nodejs/test/message/source_map_enclosing_function.js

This file was deleted.

9 changes: 0 additions & 9 deletions graal-nodejs/test/message/source_map_reference_error_tabs.out

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions graal-nodejs/test/message/source_map_throw_catch.out

This file was deleted.

9 changes: 0 additions & 9 deletions graal-nodejs/test/message/source_map_throw_icu.out

This file was deleted.

5 changes: 0 additions & 5 deletions graal-nodejs/test/message/source_map_throw_set_immediate.js

This file was deleted.

10 changes: 0 additions & 10 deletions graal-nodejs/test/message/source_map_throw_set_immediate.out

This file was deleted.

6 changes: 6 additions & 0 deletions graal-nodejs/test/parallel/test-node-output-sourcemaps.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ describe('sourcemaps output', { concurrency: true }, () => {
const tests = [
{ name: 'source-map/output/source_map_disabled_by_api.js' },
{ name: 'source-map/output/source_map_enabled_by_api.js' },
{ name: 'source-map/output/source_map_enclosing_function.js' },
{ name: 'source-map/output/source_map_eval.js' },
{ name: 'source-map/output/source_map_no_source_file.js' },
{ name: 'source-map/output/source_map_reference_error_tabs.js' },
{ name: 'source-map/output/source_map_sourcemapping_url_string.js' },
{ name: 'source-map/output/source_map_throw_catch.js' },
{ name: 'source-map/output/source_map_throw_first_tick.js' },
{ name: 'source-map/output/source_map_throw_icu.js' },
{ name: 'source-map/output/source_map_throw_set_immediate.js' },
];
for (const { name, transform } of tests) {
it(name, async () => {
Expand Down

0 comments on commit 9c2c96a

Please sign in to comment.