You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: js_unit_tests.rs
    path of file: ./repos/deno/tests/integration
    
    the code of the file until where you have to start completion: // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use std::io::BufRead;
use std::io::BufReader;
use std::time::Duration;
use std::time::Instant;
use test_util as util;

util::unit_test_factory!(
  js_unit_test,
  "../tests/unit",
  "*.ts",
  [
    abort_controller_test,
    blob_test,
    body_test,
    broadcast_channel_test,
    buffer_test,
    build_test,
    cache_api_test,
    chmod_test,
    chown_test,
    command_test,
    console_test,
    copy_file_test,
    custom_event_test,
    cron_test,
    dir_test,
    dom_exception_test,
    error_stack_test,
    error_test,
    esnext_test,
    event_target_test,
    event
    
fn js_unit_test(test: String) {
  let _g = util::http_server();

  let deno = util::deno_cmd()
    .current_dir(util::root_path())
    .arg("test")
    .arg("--config")
    .arg(util::deno_config_path())
    .arg("--no-lock")
    .arg("--unstable")
    .arg("--location=http://127.0.0.1:4545/")
    .arg("--no-prompt");

  // TODO(mmastrac): it would be better to just load a test CA for all tests
  let deno = if test == "websocket_test" {
    deno.arg("--unsafely-ignore-certificate-errors")
  } else {
    deno
  };

  let mut deno = deno
    .arg("-A")
    .arg(util::tests_path().join("unit").join(format!("{test}.ts")))
    .piped_output()
    .spawn()
    .expect("failed to spawn script");

  let now = Instant::now();
  let stdout = deno.stdout.take().unwrap();
  let test_name = test.clone();
  let stdout = std::thread::spawn(move || {
    let reader = BufReader::new(stdout);
    for line in reader.lines() {
      if let Ok(line) = line {
        println!("[{test_name} {:0>6.2}] {line}", now.elapsed().as_secs_f32());
      } else {
        break;
      }
    }
  });

  let now = Instant::now();
  let stderr = deno.stderr.take().unwrap();
  let test_name = test.clone();
  let stderr = std::thread::spawn(move || {
    let reader = BufReader::new(stderr);
    for line in reader.lines() {
      if let Ok(line) = line {
        eprintln!("[{test_name} {:0>6.2}] {line}", now.elapsed().as_secs_f32());
      } else {
        break;
      }
    }
  });

  const PER_TEST_TIMEOUT: Duration = Duration::from_secs(3 * 60);

  let now = Instant::now();
  let status = loop {
    if now.elapsed() > PER_TEST_TIMEOUT {
      // Last-ditch kill
      _ = deno.kill();
      panic!("Test {test} failed to complete in time");
    }
    if let Some(status) = deno
      .try_wait()
      .expect("failed to wait for the child process")
    {
      break status;
    }
    std::thread::sleep(Duration::from_millis(100));
  };

  #[cfg(unix)]
  assert_eq!(
    std::os::unix::process::ExitStatusExt::signal(&status),
    None,
    "Deno should not have died with a signal"
  );
  assert_eq!(Some(0), status.code(), "Deno should have exited cleanly");

  stdout.join().unwrap();
  stderr.join().unwrap();

  assert!(status.success());
}