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 343cabf
Showing 1 changed file with 11 additions and 31 deletions.
42 changes: 11 additions & 31 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 @@ -521,22 +503,20 @@ export default function (
// the options object with useless options
delete task.options.throws;

await assert.rejects(run(task), function (err: Error) {
assert.ok(
throwMsg === true || err.message.includes(throwMsg),
`
await assert.rejects(
() => run(task),
(err: Error) => {
assert.ok(
throwMsg === true || err.message.includes(throwMsg),
`
Expected Error: ${throwMsg}
Actual Error: ${err.message}`,
);
return true;
});
);
return true;
},
);
} else {
const result = await run(task);
if (task.exec.code) {
if (result && typeof result.then === "function") {
return result;
}
}
return run(task);
}
},
);
Expand Down

0 comments on commit 343cabf

Please sign in to comment.