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: #47707

test: migrate message source map tests from Python to JS
PR-URL: #49238
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
  • Loading branch information
Yiyun Lei authored Aug 29, 2023
1 parent 7104a71 commit 9cd70f4
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)
at Module._compile (node:internal*modules*cjs*loader:1241:14)
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');
10 changes: 10 additions & 0 deletions test/fixtures/source-map/output/source_map_throw_icu.snapshot
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:478:21)

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

This file was deleted.

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

This file was deleted.

3 changes: 0 additions & 3 deletions test/message/source_map_sourcemapping_url_string.out

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

6 changes: 6 additions & 0 deletions test/parallel/test-node-output-sourcemaps.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,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 9cd70f4

Please sign in to comment.