Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: migrate message source map tests from Python to JS #49238

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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