mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
WIP
This commit is contained in:
parent
2fce56964e
commit
fd35d4b688
2 changed files with 52 additions and 0 deletions
|
@ -962,6 +962,56 @@ globalThis.afterEach = afterEach;
|
|||
globalThis.it = it;
|
||||
globalThis.describe = describe;
|
||||
|
||||
/**
|
||||
* @param {number} seed
|
||||
*/
|
||||
function prepareTests(seed) {
|
||||
const hasOnly = BDD_CONTEXT.hasOnly;
|
||||
|
||||
if (hasOnly) {
|
||||
ROOT_TEST_GROUP.only = ROOT_TEST_GROUP.children.some((child) => child.only);
|
||||
}
|
||||
|
||||
const stack = [ROOT_TEST_GROUP];
|
||||
/** @type {TestGroup | undefined} */
|
||||
let group;
|
||||
// deno-lint-ignore no-extra-boolean-cast
|
||||
while (!!(group = stack.pop())) {
|
||||
if (hasOnly && !group.only) {
|
||||
group.ignore = true;
|
||||
}
|
||||
|
||||
if (seed > 0 && !group.ignore && group.children.length > 1) {
|
||||
shuffle(group.children, seed);
|
||||
}
|
||||
|
||||
// Sort tests:
|
||||
// - non-ignored tests first (might be shuffled earlier)
|
||||
// - ignored tests second
|
||||
// - groups last
|
||||
group.children.sort(sortTestItems);
|
||||
|
||||
for (let i = 0; i < group.children.length; i++) {
|
||||
const child = group.children[i];
|
||||
|
||||
if (group.ignore) {
|
||||
child.ignore = true;
|
||||
}
|
||||
|
||||
if (isTestGroup(child)) {
|
||||
stack.push(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {*} seed
|
||||
* @param {*} group
|
||||
*/
|
||||
function prepareGroup(seed, group) {
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called from Rust.
|
||||
* @param {number} seed
|
||||
|
|
|
@ -855,6 +855,8 @@ pub async fn run_tests_for_worker(
|
|||
.js_runtime
|
||||
.with_event_loop_promise(call, PollEventLoopOptions::default())
|
||||
.await;
|
||||
|
||||
_ = send_test_event(&state_rc, TestEvent::Completed);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue