Rework the testrunner to pass the input filename only.
This commit is contained in:
parent
aa669ef902
commit
5f9539e9cc
@ -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")) {
|
||||
|
||||
@ -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),
|
||||
});
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
define("amd/module-name/output", [], function () {
|
||||
define("amd/module-name/input", [], function () {
|
||||
"use strict";
|
||||
|
||||
foobar();
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
define("loose/module-name/output", [], function () {
|
||||
define("loose/module-name/input", [], function () {
|
||||
"use strict";
|
||||
|
||||
foobar();
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user