summaryrefslogtreecommitdiff
path: root/test/fixtures/source-map
diff options
context:
space:
mode:
Diffstat (limited to 'test/fixtures/source-map')
-rw-r--r--test/fixtures/source-map/babel-esm-original.mjs9
-rw-r--r--test/fixtures/source-map/babel-esm.mjs10
-rw-r--r--test/fixtures/source-map/babel-throw-original.js19
-rw-r--r--test/fixtures/source-map/babel-throw.js21
-rw-r--r--test/fixtures/source-map/basic.js2
-rw-r--r--test/fixtures/source-map/esm-basic.mjs2
-rw-r--r--test/fixtures/source-map/esm-dep.mjs2
-rw-r--r--test/fixtures/source-map/exit-1.js2
-rw-r--r--test/fixtures/source-map/istanbul-throw-original.js10
-rw-r--r--test/fixtures/source-map/istanbul-throw.js4
-rw-r--r--test/fixtures/source-map/sigint.js2
-rw-r--r--test/fixtures/source-map/typescript-throw.js27
-rw-r--r--test/fixtures/source-map/typescript-throw.js.map1
-rw-r--r--test/fixtures/source-map/typescript-throw.ts24
-rw-r--r--test/fixtures/source-map/uglify-throw-original.js10
-rw-r--r--test/fixtures/source-map/uglify-throw.js2
16 files changed, 142 insertions, 5 deletions
diff --git a/test/fixtures/source-map/babel-esm-original.mjs b/test/fixtures/source-map/babel-esm-original.mjs
new file mode 100644
index 0000000000..70ae479452
--- /dev/null
+++ b/test/fixtures/source-map/babel-esm-original.mjs
@@ -0,0 +1,9 @@
+import {foo} from './esm-dep.mjs';
+
+const obj = {
+ a: {
+ b: 22
+ }
+};
+
+if (obj?.a?.b === 22) throw Error('an exception');
diff --git a/test/fixtures/source-map/babel-esm.mjs b/test/fixtures/source-map/babel-esm.mjs
new file mode 100644
index 0000000000..9ad84663a3
--- /dev/null
+++ b/test/fixtures/source-map/babel-esm.mjs
@@ -0,0 +1,10 @@
+var _obj$a;
+
+import { foo } from './esm-dep.mjs';
+const obj = {
+ a: {
+ b: 22
+ }
+};
+if ((obj === null || obj === void 0 ? void 0 : (_obj$a = obj.a) === null || _obj$a === void 0 ? void 0 : _obj$a.b) === 22) throw Error('an exception');
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJhYmVsLWVzbS1vcmlnaW5hbC5tanMiXSwibmFtZXMiOlsiZm9vIiwib2JqIiwiYSIsImIiLCJFcnJvciJdLCJtYXBwaW5ncyI6Ijs7QUFBQSxTQUFRQSxHQUFSLFFBQWtCLGVBQWxCO0FBRUEsTUFBTUMsR0FBRyxHQUFHO0FBQ1ZDLEVBQUFBLENBQUMsRUFBRTtBQUNEQyxJQUFBQSxDQUFDLEVBQUU7QUFERjtBQURPLENBQVo7QUFNQSxJQUFJLENBQUFGLEdBQUcsU0FBSCxJQUFBQSxHQUFHLFdBQUgsc0JBQUFBLEdBQUcsQ0FBRUMsQ0FBTCxrREFBUUMsQ0FBUixNQUFjLEVBQWxCLEVBQXNCLE1BQU1DLEtBQUssQ0FBQyxjQUFELENBQVgiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQge2Zvb30gZnJvbSAnLi9lc20tZGVwLm1qcyc7XG5cbmNvbnN0IG9iaiA9IHtcbiAgYToge1xuICAgIGI6IDIyXG4gIH1cbn07XG5cbmlmIChvYmo/LmE/LmIgPT09IDIyKSB0aHJvdyBFcnJvcignYW4gZXhjZXB0aW9uJyk7XG5cbiJdfQ==
diff --git a/test/fixtures/source-map/babel-throw-original.js b/test/fixtures/source-map/babel-throw-original.js
new file mode 100644
index 0000000000..779bd16fd4
--- /dev/null
+++ b/test/fixtures/source-map/babel-throw-original.js
@@ -0,0 +1,19 @@
+/*---
+esid: prod-OptionalExpression
+features: [optional-chaining]
+---*/
+
+const obj = {
+ a: {
+ b: 22
+ }
+};
+
+function fn () {
+ return {};
+}
+
+setTimeout((err) => {
+ // OptionalExpression (MemberExpression OptionalChain) OptionalChain
+ if (obj?.a?.b === 22) throw Error('an exception');
+}, 5);
diff --git a/test/fixtures/source-map/babel-throw.js b/test/fixtures/source-map/babel-throw.js
new file mode 100644
index 0000000000..3cef68136c
--- /dev/null
+++ b/test/fixtures/source-map/babel-throw.js
@@ -0,0 +1,21 @@
+/*---
+esid: prod-OptionalExpression
+features: [optional-chaining]
+---*/
+const obj = {
+ a: {
+ b: 22
+ }
+};
+
+function fn() {
+ return {};
+}
+
+setTimeout(err => {
+ var _obj$a;
+
+ // OptionalExpression (MemberExpression OptionalChain) OptionalChain
+ if ((obj === null || obj === void 0 ? void 0 : (_obj$a = obj.a) === null || _obj$a === void 0 ? void 0 : _obj$a.b) === 22) throw Error('an exception');
+}, 5);
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJhYmVsLXRocm93LW9yaWdpbmFsLmpzIl0sIm5hbWVzIjpbIm9iaiIsImEiLCJiIiwiZm4iLCJzZXRUaW1lb3V0IiwiZXJyIiwiRXJyb3IiXSwibWFwcGluZ3MiOiJBQUFBOzs7O0FBS0EsTUFBTUEsR0FBRyxHQUFHO0FBQ1ZDLEVBQUFBLENBQUMsRUFBRTtBQUNEQyxJQUFBQSxDQUFDLEVBQUU7QUFERjtBQURPLENBQVo7O0FBTUEsU0FBU0MsRUFBVCxHQUFlO0FBQ2IsU0FBTyxFQUFQO0FBQ0Q7O0FBRURDLFVBQVUsQ0FBRUMsR0FBRCxJQUFTO0FBQUE7O0FBQ2xCO0FBQ0EsTUFBSSxDQUFBTCxHQUFHLFNBQUgsSUFBQUEsR0FBRyxXQUFILHNCQUFBQSxHQUFHLENBQUVDLENBQUwsa0RBQVFDLENBQVIsTUFBYyxFQUFsQixFQUFzQixNQUFNSSxLQUFLLENBQUMsY0FBRCxDQUFYO0FBQ3ZCLENBSFMsRUFHUCxDQUhPLENBQVYiLCJzb3VyY2VzQ29udGVudCI6WyIvKi0tLVxuZXNpZDogcHJvZC1PcHRpb25hbEV4cHJlc3Npb25cbmZlYXR1cmVzOiBbb3B0aW9uYWwtY2hhaW5pbmddXG4tLS0qL1xuXG5jb25zdCBvYmogPSB7XG4gIGE6IHtcbiAgICBiOiAyMlxuICB9XG59O1xuXG5mdW5jdGlvbiBmbiAoKSB7XG4gIHJldHVybiB7fTtcbn1cblxuc2V0VGltZW91dCgoZXJyKSA9PiB7XG4gIC8vIE9wdGlvbmFsRXhwcmVzc2lvbiAoTWVtYmVyRXhwcmVzc2lvbiBPcHRpb25hbENoYWluKSBPcHRpb25hbENoYWluXG4gIGlmIChvYmo/LmE/LmIgPT09IDIyKSB0aHJvdyBFcnJvcignYW4gZXhjZXB0aW9uJyk7XG59LCA1KTtcblxuIl19
diff --git a/test/fixtures/source-map/basic.js b/test/fixtures/source-map/basic.js
index a483ffb105..5d1420360f 100644
--- a/test/fixtures/source-map/basic.js
+++ b/test/fixtures/source-map/basic.js
@@ -4,4 +4,4 @@ if (true) {
} else {
const c = 102;
}
-//# sourceMappingURL=https://http.cat/418
+//# sourceMappingURL=https://ci.nodejs.org/418
diff --git a/test/fixtures/source-map/esm-basic.mjs b/test/fixtures/source-map/esm-basic.mjs
index 55747d3870..03222b244b 100644
--- a/test/fixtures/source-map/esm-basic.mjs
+++ b/test/fixtures/source-map/esm-basic.mjs
@@ -1,4 +1,4 @@
import {foo} from './esm-dep.mjs';
import {strictEqual} from 'assert';
strictEqual(foo(), 'foo');
-//# sourceMappingURL=https://http.cat/405
+//# sourceMappingURL=https://ci.nodejs.org/405
diff --git a/test/fixtures/source-map/esm-dep.mjs b/test/fixtures/source-map/esm-dep.mjs
index 00805894af..5e86405751 100644
--- a/test/fixtures/source-map/esm-dep.mjs
+++ b/test/fixtures/source-map/esm-dep.mjs
@@ -1,4 +1,4 @@
export function foo () {
return 'foo';
};
-//# sourceMappingURL=https://http.cat/422
+//# sourceMappingURL=https://ci.nodejs.org/422
diff --git a/test/fixtures/source-map/exit-1.js b/test/fixtures/source-map/exit-1.js
index 9734649a77..d8b5626445 100644
--- a/test/fixtures/source-map/exit-1.js
+++ b/test/fixtures/source-map/exit-1.js
@@ -5,4 +5,4 @@ if (true) {
const c = 102;
}
process.exit(1);
-//# sourceMappingURL=https://http.cat/404
+//# sourceMappingURL=https://ci.nodejs.org/404
diff --git a/test/fixtures/source-map/istanbul-throw-original.js b/test/fixtures/source-map/istanbul-throw-original.js
new file mode 100644
index 0000000000..099faa175d
--- /dev/null
+++ b/test/fixtures/source-map/istanbul-throw-original.js
@@ -0,0 +1,10 @@
+/*
+ * comments dropped by uglify.
+ */
+function Hello() {
+ throw Error('goodbye');
+}
+
+setImmediate(function() {
+ Hello();
+});
diff --git a/test/fixtures/source-map/istanbul-throw.js b/test/fixtures/source-map/istanbul-throw.js
new file mode 100644
index 0000000000..4f719a1c7a
--- /dev/null
+++ b/test/fixtures/source-map/istanbul-throw.js
@@ -0,0 +1,4 @@
+var cov_ono70fls3=function(){var path="/Users/bencoe/oss/source-map-testing/istanbul-throw-original.js";var hash="4302fcea4eb0ea4d9af6e63a478f214aa61f9dd8";var global=new Function("return this")();var gcv="__coverage__";var coverageData={path:"/Users/bencoe/oss/source-map-testing/istanbul-throw-original.js",statementMap:{"0":{start:{line:5,column:2},end:{line:5,column:25}},"1":{start:{line:8,column:0},end:{line:10,column:3}},"2":{start:{line:9,column:2},end:{line:9,column:10}}},fnMap:{"0":{name:"Hello",decl:{start:{line:4,column:9},end:{line:4,column:14}},loc:{start:{line:4,column:17},end:{line:6,column:1}},line:4},"1":{name:"(anonymous_1)",decl:{start:{line:8,column:13},end:{line:8,column:14}},loc:{start:{line:8,column:24},end:{line:10,column:1}},line:8}},branchMap:{},s:{"0":0,"1":0,"2":0},f:{"0":0,"1":0},b:{},_coverageSchema:"43e27e138ebf9cfc5966b082cf9a028302ed4184",hash:"4302fcea4eb0ea4d9af6e63a478f214aa61f9dd8"};var coverage=global[gcv]||(global[gcv]={});if(coverage[path]&&coverage[path].hash===hash){return coverage[path];}return coverage[path]=coverageData;}();/*
+ * comments dropped by uglify.
+ */function Hello(){cov_ono70fls3.f[0]++;cov_ono70fls3.s[0]++;throw Error('goodbye');}cov_ono70fls3.s[1]++;setImmediate(function(){cov_ono70fls3.f[1]++;cov_ono70fls3.s[2]++;Hello();});
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9iZW5jb2Uvb3NzL3NvdXJjZS1tYXAtdGVzdGluZy9pc3RhbmJ1bC10aHJvdy1vcmlnaW5hbC5qcyJdLCJuYW1lcyI6WyJIZWxsbyIsIkVycm9yIiwic2V0SW1tZWRpYXRlIl0sIm1hcHBpbmdzIjoiMmpDQUFBOztHQUdBLFFBQVNBLENBQUFBLEtBQVQsRUFBaUIsMkNBQ2YsS0FBTUMsQ0FBQUEsS0FBSyxDQUFDLFNBQUQsQ0FBWCxDQUNELEMscUJBRURDLFlBQVksQ0FBQyxVQUFXLDJDQUN0QkYsS0FBSyxHQUNOLENBRlcsQ0FBWiIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBjb21tZW50cyBkcm9wcGVkIGJ5IHVnbGlmeS5cbiAqL1xuZnVuY3Rpb24gSGVsbG8oKSB7XG4gIHRocm93IEVycm9yKCdnb29kYnllJyk7XG59XG5cbnNldEltbWVkaWF0ZShmdW5jdGlvbigpIHtcbiAgSGVsbG8oKTtcbn0pO1xuXG4iXX0=
diff --git a/test/fixtures/source-map/sigint.js b/test/fixtures/source-map/sigint.js
index 11df66645f..f9ffaa8666 100644
--- a/test/fixtures/source-map/sigint.js
+++ b/test/fixtures/source-map/sigint.js
@@ -5,4 +5,4 @@ if (true) {
const c = 102;
}
process.kill(process.pid, "SIGINT");
-//# sourceMappingURL=https://http.cat/402
+//# sourceMappingURL=https://ci.nodejs.org/402
diff --git a/test/fixtures/source-map/typescript-throw.js b/test/fixtures/source-map/typescript-throw.js
new file mode 100644
index 0000000000..0c4e57756f
--- /dev/null
+++ b/test/fixtures/source-map/typescript-throw.js
@@ -0,0 +1,27 @@
+var ATrue;
+(function (ATrue) {
+ ATrue[ATrue["IsTrue"] = 1] = "IsTrue";
+ ATrue[ATrue["IsFalse"] = 0] = "IsFalse";
+})(ATrue || (ATrue = {}));
+if (false) {
+ console.info('unreachable');
+}
+else if (true) {
+ console.info('reachable');
+}
+else {
+ console.info('unreachable');
+}
+function branch(a) {
+ if (a === ATrue.IsFalse) {
+ console.info('a = false');
+ }
+ else if (a === ATrue.IsTrue) {
+ throw Error('an exception');
+ }
+ else {
+ console.info('a = ???');
+ }
+}
+branch(ATrue.IsTrue);
+//# sourceMappingURL=typescript-throw.js.map
diff --git a/test/fixtures/source-map/typescript-throw.js.map b/test/fixtures/source-map/typescript-throw.js.map
new file mode 100644
index 0000000000..f1f55af1a9
--- /dev/null
+++ b/test/fixtures/source-map/typescript-throw.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"typescript-throw.js","sourceRoot":"","sources":["typescript-throw.ts"],"names":[],"mappings":"AAAA,IAAK,KAGJ;AAHD,WAAK,KAAK;IACR,qCAAU,CAAA;IACV,uCAAW,CAAA;AACb,CAAC,EAHI,KAAK,KAAL,KAAK,QAGT;AAED,IAAI,KAAK,EAAE;IACT,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;CAC5B;KAAM,IAAI,IAAI,EAAE;IACf,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;CAC1B;KAAM;IACL,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;CAC5B;AAED,SAAS,MAAM,CAAE,CAAQ;IACvB,IAAI,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE;QACvB,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;KAC1B;SAAM,IAAI,CAAC,KAAK,KAAK,CAAC,MAAM,EAAE;QAC7B,MAAM,KAAK,CAAC,cAAc,CAAC,CAAC;KAC7B;SAAM;QACL,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;KACxB;AACH,CAAC;AAED,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA"}
diff --git a/test/fixtures/source-map/typescript-throw.ts b/test/fixtures/source-map/typescript-throw.ts
new file mode 100644
index 0000000000..befb58fe0a
--- /dev/null
+++ b/test/fixtures/source-map/typescript-throw.ts
@@ -0,0 +1,24 @@
+enum ATrue {
+ IsTrue = 1,
+ IsFalse = 0
+}
+
+if (false) {
+ console.info('unreachable')
+} else if (true) {
+ console.info('reachable')
+} else {
+ console.info('unreachable')
+}
+
+function branch (a: ATrue) {
+ if (a === ATrue.IsFalse) {
+ console.info('a = false')
+ } else if (a === ATrue.IsTrue) {
+ throw Error('an exception');
+ } else {
+ console.info('a = ???')
+ }
+}
+
+branch(ATrue.IsTrue)
diff --git a/test/fixtures/source-map/uglify-throw-original.js b/test/fixtures/source-map/uglify-throw-original.js
new file mode 100644
index 0000000000..099faa175d
--- /dev/null
+++ b/test/fixtures/source-map/uglify-throw-original.js
@@ -0,0 +1,10 @@
+/*
+ * comments dropped by uglify.
+ */
+function Hello() {
+ throw Error('goodbye');
+}
+
+setImmediate(function() {
+ Hello();
+});
diff --git a/test/fixtures/source-map/uglify-throw.js b/test/fixtures/source-map/uglify-throw.js
new file mode 100644
index 0000000000..ea6201e59d
--- /dev/null
+++ b/test/fixtures/source-map/uglify-throw.js
@@ -0,0 +1,2 @@
+setImmediate(function(){!function(){throw Error("goodbye")}()});
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInVnbGlmeS10aHJvdy1vcmlnaW5hbC5qcyJdLCJuYW1lcyI6WyJzZXRJbW1lZGlhdGUiLCJFcnJvciIsIkhlbGxvIl0sIm1hcHBpbmdzIjoiQUFPQUEsYUFBYSxZQUpiLFdBQ0UsTUFBTUMsTUFBTSxXQUlaQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBjb21tZW50cyBkcm9wcGVkIGJ5IHVnbGlmeS5cbiAqL1xuZnVuY3Rpb24gSGVsbG8oKSB7XG4gIHRocm93IEVycm9yKCdnb29kYnllJyk7XG59XG5cbnNldEltbWVkaWF0ZShmdW5jdGlvbigpIHtcbiAgSGVsbG8oKTtcbn0pO1xuXG4iXX0=