Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Jun 14, 2022
1 parent 70aa87e commit 22bcbfa
Showing 1 changed file with 3 additions and 25 deletions.
28 changes: 3 additions & 25 deletions packages/babel-helper-transform-fixture-test-runner/src/index.ts
Expand Up @@ -20,24 +20,6 @@ const require = createRequire(import.meta.url);

import checkDuplicateNodes from "@babel/helper-check-duplicate-nodes";

if (!process.env.BABEL_8_BREAKING) {
// Introduced in Node.js 10
if (!assert.rejects) {
assert.rejects = async function (promise, validateError) {
try {
await promise;
return Promise.reject(new Error("Promise not rejected"));
} catch (error) {
if (!validateError(error)) {
return Promise.reject(
new Error("Promise rejected with invalid error"),
);
}
}
};
}
}

const EXTERNAL_HELPERS_VERSION = "7.100.0";

const cachedScripts = new QuickLRU<
Expand Down Expand Up @@ -497,6 +479,7 @@ export default function (
task.title,

async function () {
const runTask = () => run(task);
if ("sourceMap" in task.options === false) {
task.options.sourceMap = !!(
task.sourceMappings || task.sourceMap
Expand All @@ -521,7 +504,7 @@ export default function (
// the options object with useless options
delete task.options.throws;

await assert.rejects(run(task), function (err: Error) {
await assert.rejects(runTask, function (err: Error) {
assert.ok(
throwMsg === true || err.message.includes(throwMsg),
`
Expand All @@ -531,12 +514,7 @@ Actual Error: ${err.message}`,
return true;
});
} else {
const result = await run(task);
if (task.exec.code) {
if (result && typeof result.then === "function") {
return result;
}
}
return runTask();
}
},
);
Expand Down

0 comments on commit 22bcbfa

Please sign in to comment.