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;
|
if (ext !== ".js" && ext !== ".mjs") return;
|
||||||
|
|
||||||
execLoc = taskDir;
|
execLoc = taskDir;
|
||||||
|
execLocAlias = suiteName + "/" + taskName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resolve.relative(expectLoc + "on")) {
|
if (resolve.relative(expectLoc + "on")) {
|
||||||
|
|||||||
@ -329,7 +329,10 @@ function run(task) {
|
|||||||
const newOpts = merge(
|
const newOpts = merge(
|
||||||
{
|
{
|
||||||
filename: self.loc,
|
filename: self.loc,
|
||||||
|
filenameRelative: self.filename,
|
||||||
|
sourceFileName: self.filename,
|
||||||
sourceType: "unambiguous",
|
sourceType: "unambiguous",
|
||||||
|
babelrc: false,
|
||||||
},
|
},
|
||||||
opts,
|
opts,
|
||||||
);
|
);
|
||||||
@ -377,7 +380,15 @@ function run(task) {
|
|||||||
let actualCode = actual.code;
|
let actualCode = actual.code;
|
||||||
const expectCode = expected.code;
|
const expectCode = expected.code;
|
||||||
if (!execCode || actualCode) {
|
if (!execCode || actualCode) {
|
||||||
result = babel.transform(actualCode, getOpts(actual));
|
result = babel.transform(
|
||||||
|
actualCode,
|
||||||
|
Object.assign(
|
||||||
|
{
|
||||||
|
sourceMapTarget: task.expect.filename,
|
||||||
|
},
|
||||||
|
getOpts(actual),
|
||||||
|
),
|
||||||
|
);
|
||||||
checkDuplicatedNodes(result.ast);
|
checkDuplicatedNodes(result.ast);
|
||||||
if (
|
if (
|
||||||
!expected.code &&
|
!expected.code &&
|
||||||
@ -444,10 +455,6 @@ export default function(
|
|||||||
}
|
}
|
||||||
|
|
||||||
defaults(task.options, {
|
defaults(task.options, {
|
||||||
filenameRelative: task.expect.filename,
|
|
||||||
sourceFileName: task.actual.filename,
|
|
||||||
sourceMapTarget: task.expect.filename,
|
|
||||||
babelrc: false,
|
|
||||||
sourceMap: !!(task.sourceMappings || task.sourceMap),
|
sourceMap: !!(task.sourceMappings || task.sourceMap),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
define("amd/module-name/output", [], function () {
|
define("amd/module-name/input", [], function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
foobar();
|
foobar();
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
define("loose/module-name/output", [], function () {
|
define("loose/module-name/input", [], function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
foobar();
|
foobar();
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
if (typeof define === "function" && define.amd) {
|
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") {
|
} else if (typeof exports !== "undefined") {
|
||||||
factory(exports);
|
factory(exports);
|
||||||
} else {
|
} else {
|
||||||
@ -8,7 +8,7 @@
|
|||||||
exports: {}
|
exports: {}
|
||||||
};
|
};
|
||||||
factory(mod.exports);
|
factory(mod.exports);
|
||||||
global.looseModuleNameWithOverriddenGlobalOutput = mod.exports;
|
global.looseModuleNameWithOverriddenGlobalInput = mod.exports;
|
||||||
}
|
}
|
||||||
})(this, function (_exports) {
|
})(this, function (_exports) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
if (typeof define === "function" && define.amd) {
|
if (typeof define === "function" && define.amd) {
|
||||||
define("loose/module-name/output", [], factory);
|
define("loose/module-name/input", [], factory);
|
||||||
} else if (typeof exports !== "undefined") {
|
} else if (typeof exports !== "undefined") {
|
||||||
factory();
|
factory();
|
||||||
} else {
|
} else {
|
||||||
@ -8,7 +8,7 @@
|
|||||||
exports: {}
|
exports: {}
|
||||||
};
|
};
|
||||||
factory();
|
factory();
|
||||||
global.looseModuleNameOutput = mod.exports;
|
global.looseModuleNameInput = mod.exports;
|
||||||
}
|
}
|
||||||
})(this, function () {
|
})(this, function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
if (typeof define === "function" && define.amd) {
|
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") {
|
} else if (typeof exports !== "undefined") {
|
||||||
factory(exports);
|
factory(exports);
|
||||||
} else {
|
} else {
|
||||||
@ -8,7 +8,7 @@
|
|||||||
exports: {}
|
exports: {}
|
||||||
};
|
};
|
||||||
factory(mod.exports);
|
factory(mod.exports);
|
||||||
global.umdModuleNameWithOverriddenGlobalOutput = mod.exports;
|
global.umdModuleNameWithOverriddenGlobalInput = mod.exports;
|
||||||
}
|
}
|
||||||
})(this, function (_exports) {
|
})(this, function (_exports) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
if (typeof define === "function" && define.amd) {
|
if (typeof define === "function" && define.amd) {
|
||||||
define("umd/module-name/output", [], factory);
|
define("umd/module-name/input", [], factory);
|
||||||
} else if (typeof exports !== "undefined") {
|
} else if (typeof exports !== "undefined") {
|
||||||
factory();
|
factory();
|
||||||
} else {
|
} else {
|
||||||
@ -8,7 +8,7 @@
|
|||||||
exports: {}
|
exports: {}
|
||||||
};
|
};
|
||||||
factory();
|
factory();
|
||||||
global.umdModuleNameOutput = mod.exports;
|
global.umdModuleNameInput = mod.exports;
|
||||||
}
|
}
|
||||||
})(this, function () {
|
})(this, function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user