summaryrefslogtreecommitdiff
path: root/cli/tests/std_tests.rs
blob: d1ed599bc62804556ba3c2ff2cc1bcfe4066daf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.

// TODO: fix tests in debug mode
// Runs only on release build
#[cfg(not(debug_assertions))]
mod tests {
  extern crate lazy_static;
  extern crate tempfile;
  use deno_cli::test_util::*;
  use std::process::Command;
  use tempfile::TempDir;

  #[test]
  fn std_tests() {
    let dir = TempDir::new().expect("tempdir fail");
    let mut deno_cmd = Command::new(deno_exe_path());
    deno_cmd.env("DENO_DIR", dir.path());

    let mut cwd = root_path();
    cwd.push("std");
    let mut deno = deno_cmd
      .current_dir(cwd) // note: std tests expect to run from "std" dir
      .arg("-A")
      // .arg("-Ldebug")
      .arg("./testing/runner.ts")
      .arg("--exclude=testing/testdata")
      .spawn()
      .expect("failed to spawn script");
    let status = deno.wait().expect("failed to wait for the child process");
    assert!(status.success());
  }
}