Rework the testrunner to pass the input filename only.

This commit is contained in:
Logan Smyth 2018-03-03 17:14:47 -08:00
parent aa669ef902
commit 5f9539e9cc
8 changed files with 23 additions and 15 deletions

View File

@ -124,6 +124,7 @@ export default function get(entryLoc): Array<Suite> {
if (ext !== ".js" && ext !== ".mjs") return;
execLoc = taskDir;
execLocAlias = suiteName + "/" + taskName;
}
if (resolve.relative(expectLoc + "on")) {

View File

@ -329,7 +329,10 @@ function run(task) {
const newOpts = merge(
{
filename: self.loc,
filenameRelative: self.filename,
sourceFileName: self.filename,
sourceType: "unambiguous",
babelrc: false,
},
opts,
);
@ -377,7 +380,15 @@ function run(task) {
let actualCode = actual.code;
const expectCode = expected.code;
if (!execCode || actualCode) {
result = babel.transform(actualCode, getOpts(actual));
result = babel.transform(
actualCode,
Object.assign(
{
sourceMapTarget: task.expect.filename,
},
getOpts(actual),
),
);
checkDuplicatedNodes(result.ast);
if (
!expected.code &&
@ -444,10 +455,6 @@ export default function(
}
defaults(task.options, {
filenameRelative: task.expect.filename,
sourceFileName: task.actual.filename,
sourceMapTarget: task.expect.filename,
babelrc: false,
sourceMap: !!(task.sourceMappings || task.sourceMap),
});

View File

@ -1,4 +1,4 @@
define("amd/module-name/output", [], function () {
define("amd/module-name/input", [], function () {
"use strict";
foobar();

View File

@ -1,4 +1,4 @@
define("loose/module-name/output", [], function () {
define("loose/module-name/input", [], function () {
"use strict";
foobar();

View File

@ -1,6 +1,6 @@
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define("loose/module-name-with-overridden-global/output", ["exports"], factory);
define("loose/module-name-with-overridden-global/input", ["exports"], factory);
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
@ -8,7 +8,7 @@
exports: {}
};
factory(mod.exports);
global.looseModuleNameWithOverriddenGlobalOutput = mod.exports;
global.looseModuleNameWithOverriddenGlobalInput = mod.exports;
}
})(this, function (_exports) {
"use strict";

View File

@ -1,6 +1,6 @@
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define("loose/module-name/output", [], factory);
define("loose/module-name/input", [], factory);
} else if (typeof exports !== "undefined") {
factory();
} else {
@ -8,7 +8,7 @@
exports: {}
};
factory();
global.looseModuleNameOutput = mod.exports;
global.looseModuleNameInput = mod.exports;
}
})(this, function () {
"use strict";

View File

@ -1,6 +1,6 @@
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define("umd/module-name-with-overridden-global/output", ["exports"], factory);
define("umd/module-name-with-overridden-global/input", ["exports"], factory);
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
@ -8,7 +8,7 @@
exports: {}
};
factory(mod.exports);
global.umdModuleNameWithOverriddenGlobalOutput = mod.exports;
global.umdModuleNameWithOverriddenGlobalInput = mod.exports;
}
})(this, function (_exports) {
"use strict";

View File

@ -1,6 +1,6 @@
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define("umd/module-name/output", [], factory);
define("umd/module-name/input", [], factory);
} else if (typeof exports !== "undefined") {
factory();
} else {
@ -8,7 +8,7 @@
exports: {}
};
factory();
global.umdModuleNameOutput = mod.exports;
global.umdModuleNameInput = mod.exports;
}
})(this, function () {
"use strict";