1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-11 00:21:05 -05:00

simplify unit tests: compiler_api, workers (#5073)

This commit is contained in:
Ryan Dahl 2020-05-04 10:40:18 -04:00 committed by GitHub
parent 1500547afa
commit 92c0591fcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 37 deletions

View file

@ -19,6 +19,10 @@ pub fn root_path() -> PathBuf {
PathBuf::from(concat!(env!("CARGO_MANIFEST_DIR"), "/.."))
}
pub fn tests_path() -> PathBuf {
root_path().join("cli").join("tests")
}
pub fn target_dir() -> PathBuf {
let current_exe = std::env::current_exe().unwrap();
let target_dir = current_exe.parent().unwrap().parent().unwrap();

View file

@ -1,16 +0,0 @@
running 12 tests
test compilerApiCompileSources ... ok [WILDCARD]
test compilerApiCompileNoSources ... ok [WILDCARD]
test compilerApiCompileOptions ... ok [WILDCARD]
test compilerApiCompileLib ... ok [WILDCARD]
test compilerApiCompileTypes ... ok [WILDCARD]
test transpileOnlyApi ... ok [WILDCARD]
test transpileOnlyApiConfig ... ok [WILDCARD]
test bundleApiSources ... ok [WILDCARD]
test bundleApiNoSources ... ok [WILDCARD]
test bundleApiConfig ... ok [WILDCARD]
test bundleApiJsModules ... ok [WILDCARD]
test diagnosticsTest ... ok [WILDCARD]
test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD]

View file

@ -952,16 +952,37 @@ itest!(deno_test {
output: "deno_test.out",
});
itest!(workers {
args: "test --reload --allow-net workers_test.ts",
http_server: true,
output: "workers_test.out",
});
#[test]
fn workers() {
let g = util::http_server();
let status = util::deno_cmd()
.current_dir(util::tests_path())
.arg("test")
.arg("--reload")
.arg("--allow-net")
.arg("workers_test.ts")
.spawn()
.unwrap()
.wait()
.unwrap();
assert!(status.success());
drop(g);
}
itest!(compiler_api {
args: "test --unstable --reload compiler_api_test.ts",
output: "compiler_api_test.out",
});
#[test]
fn compiler_api() {
let status = util::deno_cmd()
.current_dir(util::tests_path())
.arg("test")
.arg("--unstable")
.arg("--reload")
.arg("compiler_api_test.ts")
.spawn()
.unwrap()
.wait()
.unwrap();
assert!(status.success());
}
itest!(_027_redirect_typescript {
args: "run --reload 027_redirect_typescript.ts",

View file

@ -1,12 +0,0 @@
running 9 tests
test worker terminate ... ok [WILDCARD]
test worker nested ... ok [WILDCARD]
test worker throws when executing ... ok [WILDCARD]
test worker fetch API ... ok [WILDCARD]
test worker terminate busy loop ... ok [WILDCARD]
test worker race condition ... ok [WILDCARD]
test worker is event listener ... ok [WILDCARD]
test worker scope is event listener ... ok [WILDCARD]
test worker with Deno namespace ... ok [WILDCARD]
test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD]