1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00
This commit is contained in:
Marvin Hagemeister 2024-10-11 14:20:52 +02:00
parent 2f2df854b0
commit 2fce56964e

View file

@ -546,6 +546,10 @@ globalThis.Deno.test = test;
* only: boolean, * only: boolean,
* ignore: boolean, * ignore: boolean,
* location: TestLocationInfo, * location: TestLocationInfo,
* sanitizeOps: boolean,
* sanitizeResources: boolean,
* sanitizeExit: boolean,
* permissions?: Deno.PermissionOptions,
* }} BddTest * }} BddTest
* *
* @typedef {() => unknown | Promise<unknown>} TestLifecycleFn * @typedef {() => unknown | Promise<unknown>} TestLifecycleFn
@ -713,22 +717,31 @@ function itInner({
const parent = getGroupParent(); const parent = getGroupParent();
let testFn = fn;
if (permissions !== undefined) {
testFn = withPermissions(testFn);
}
/** @type {BddTest} */ /** @type {BddTest} */
const testDef = { const testDef = {
id: 0, id: 0,
parentId: parent.id, parentId: parent.id,
name, name,
fn, fn: testFn,
ignore, ignore,
only, only,
location, location,
sanitizeExit,
sanitizeOps,
sanitizeResources,
permissions,
}; };
parent.children.push(testDef); parent.children.push(testDef);
BDD_CONTEXT.total++; BDD_CONTEXT.total++;
op_register_test( op_register_test(
parent.id, testDef.parentId,
fn, testDef.fn,
escapeName(name), escapeName(name),
ignore, ignore,
only, only,
@ -1001,7 +1014,9 @@ async function runGroup(seed, group) {
} }
if (isTestGroup(child)) { if (isTestGroup(child)) {
await runGroup(seed, child); await runGroup(seed, child);
} else if (child.ignore || BDD_CONTEXT.hasOnly && !child.only) { } else if (
child.ignore || group.ignore || BDD_CONTEXT.hasOnly && !child.only
) {
op_test_event_result_ignored(child.id); op_test_event_result_ignored(child.id);
} else { } else {
op_test_event_start(child.id); op_test_event_start(child.id);