add more reliable source-map tests

This commit is contained in:
Sebastian McKenzie
2014-10-10 09:15:24 +11:00
parent a0c4efb152
commit d511fc8094
12 changed files with 90 additions and 36 deletions

View File

@@ -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);
}
});
});

View File

@@ -0,0 +1,3 @@
var t = function(x) {
return x * x;
};

View File

@@ -0,0 +1,10 @@
[{
"original": {
"line": 1,
"column": 15
},
"generated": {
"line": 2,
"column": 11
}
}]

View File

@@ -0,0 +1,8 @@
class Test {
get bar() {
throw new Error("wow");
}
}
var test = new Test;
test.bar;

View 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;

View File

@@ -0,0 +1,10 @@
[{
"original": {
"line": 3,
"column": 11
},
"generated": {
"line": 7,
"column": 15
}
}]

View File

@@ -1 +0,0 @@
var t = function (x) { return x * x; };

View File

@@ -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;"
]
}