mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
27 lines
1.1 KiB
JavaScript
27 lines
1.1 KiB
JavaScript
const { describe, test } = require("node:test");
|
|
const assert = require("node:assert");
|
|
|
|
// for passing to assert.throws
|
|
function expectedError(fn) {
|
|
return {
|
|
name: "NotImplementedError",
|
|
message: `${fn}() inside another test() is not yet implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/5090. Use \`bun:test\` in the interim.`,
|
|
};
|
|
}
|
|
|
|
test("test() inside test() (global context) throws", () => {
|
|
assert.throws(() => test("should throw and not run the test callback", assert.fail), expectedError("test"));
|
|
});
|
|
|
|
test("test() inside test() (passed context) throws", t => {
|
|
assert.throws(() => t.test("should throw and not run the test callback", assert.fail), expectedError("test"));
|
|
});
|
|
|
|
test("describe() inside test() (global context) throws", () => {
|
|
assert.throws(() => describe("should throw and not run the test callback", assert.fail), expectedError("describe"));
|
|
});
|
|
|
|
test("describe() inside test() (passed context) throws", t => {
|
|
assert.throws(() => t.describe("should throw and not run the test callback", assert.fail), expectedError("describe"));
|
|
});
|