add more reliable source-map tests
This commit is contained in:
@@ -71,7 +71,6 @@ exports.getTests = function () {
|
||||
var taskOpts = _.merge({ filename: actualLoc }, _.cloneDeep(suite.options));
|
||||
if (fs.existsSync(taskOptsLoc)) _.merge(taskOpts, require(taskOptsLoc));
|
||||
|
||||
|
||||
var test = {
|
||||
title: humanise(taskName),
|
||||
options: taskOpts,
|
||||
@@ -87,10 +86,10 @@ exports.getTests = function () {
|
||||
|
||||
suite.tests.push(test);
|
||||
|
||||
var sourceMapLoc = taskDir + "/source-map.json";
|
||||
if (fs.existsSync(sourceMapLoc)) {
|
||||
var sourceMappingsLoc = taskDir + "/source-mappings.json";
|
||||
if (fs.existsSync(sourceMappingsLoc)) {
|
||||
test.options.sourceMap = true;
|
||||
test.sourceMap = require(sourceMapLoc);
|
||||
test.sourceMappings = require(sourceMappingsLoc);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
3
test/fixtures/source-maps/arrow-function/expected.js
vendored
Normal file
3
test/fixtures/source-maps/arrow-function/expected.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
var t = function(x) {
|
||||
return x * x;
|
||||
};
|
||||
10
test/fixtures/source-maps/arrow-function/source-mappings.json
vendored
Normal file
10
test/fixtures/source-maps/arrow-function/source-mappings.json
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
[{
|
||||
"original": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
},
|
||||
"generated": {
|
||||
"line": 2,
|
||||
"column": 11
|
||||
}
|
||||
}]
|
||||
8
test/fixtures/source-maps/class/actual.js
vendored
Normal file
8
test/fixtures/source-maps/class/actual.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
class Test {
|
||||
get bar() {
|
||||
throw new Error("wow");
|
||||
}
|
||||
}
|
||||
|
||||
var test = new Test;
|
||||
test.bar;
|
||||
16
test/fixtures/source-maps/class/expected.js
vendored
Normal file
16
test/fixtures/source-maps/class/expected.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
var Test = function() {
|
||||
function Test() {}
|
||||
|
||||
Object.defineProperties(Test.prototype, {
|
||||
bar: {
|
||||
get: function() {
|
||||
throw new Error("wow");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return Test;
|
||||
}();
|
||||
|
||||
var test = new Test;
|
||||
test.bar;
|
||||
10
test/fixtures/source-maps/class/source-mappings.json
vendored
Normal file
10
test/fixtures/source-maps/class/source-mappings.json
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
[{
|
||||
"original": {
|
||||
"line": 3,
|
||||
"column": 11
|
||||
},
|
||||
"generated": {
|
||||
"line": 7,
|
||||
"column": 15
|
||||
}
|
||||
}]
|
||||
1
test/fixtures/source-maps/simple/expected.js
vendored
1
test/fixtures/source-maps/simple/expected.js
vendored
@@ -1 +0,0 @@
|
||||
var t = function (x) { return x * x; };
|
||||
12
test/fixtures/source-maps/simple/source-map.json
vendored
12
test/fixtures/source-maps/simple/source-map.json
vendored
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"version": 3,
|
||||
"file": "actual.js",
|
||||
"sources": [
|
||||
"actual.js"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": "AAAA,CAAC,CAAC,EAAE,EAAE,WAAE;SAAK,EAAE,EAAE;CAAC",
|
||||
"sourcesContent": [
|
||||
"var t = x => x * x;"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user