summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/bench_tests.rs17
-rw-r--r--cli/tests/integration/test_tests.rs17
-rw-r--r--cli/tests/testdata/bench/file_protocol.out8
-rw-r--r--cli/tests/testdata/bench/file_protocol.ts1
-rw-r--r--cli/tests/testdata/test/file_protocol.out6
-rw-r--r--cli/tests/testdata/test/file_protocol.ts1
6 files changed, 50 insertions, 0 deletions
diff --git a/cli/tests/integration/bench_tests.rs b/cli/tests/integration/bench_tests.rs
index 6199e5b80..1d021b69b 100644
--- a/cli/tests/integration/bench_tests.rs
+++ b/cli/tests/integration/bench_tests.rs
@@ -1,6 +1,7 @@
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
use crate::itest;
+use deno_core::url::Url;
use test_util as util;
itest!(requires_unstable {
@@ -171,3 +172,19 @@ fn recursive_permissions_pledge() {
"pledge test permissions called before restoring previous pledge"
));
}
+
+#[test]
+fn file_protocol() {
+ let file_url =
+ Url::from_file_path(util::testdata_path().join("bench/file_protocol.ts"))
+ .unwrap()
+ .to_string();
+
+ (util::CheckOutputIntegrationTest {
+ args_vec: vec!["bench", "--unstable", &file_url],
+ exit_code: 0,
+ output: "bench/file_protocol.out",
+ ..Default::default()
+ })
+ .run();
+}
diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs
index 022e40f4b..0cbc3130f 100644
--- a/cli/tests/integration/test_tests.rs
+++ b/cli/tests/integration/test_tests.rs
@@ -1,6 +1,7 @@
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
use crate::itest;
+use deno_core::url::Url;
use test_util as util;
#[test]
@@ -351,3 +352,19 @@ fn recursive_permissions_pledge() {
"pledge test permissions called before restoring previous pledge"
));
}
+
+#[test]
+fn file_protocol() {
+ let file_url =
+ Url::from_file_path(util::testdata_path().join("test/file_protocol.ts"))
+ .unwrap()
+ .to_string();
+
+ (util::CheckOutputIntegrationTest {
+ args_vec: vec!["test", &file_url],
+ exit_code: 0,
+ output: "test/file_protocol.out",
+ ..Default::default()
+ })
+ .run();
+}
diff --git a/cli/tests/testdata/bench/file_protocol.out b/cli/tests/testdata/bench/file_protocol.out
new file mode 100644
index 000000000..5a384e1fa
--- /dev/null
+++ b/cli/tests/testdata/bench/file_protocol.out
@@ -0,0 +1,8 @@
+Check file://[WILDCARD]/bench/file_protocol.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/file_protocol.ts
+benchmark time (avg) (min … max) p75 p99 p995
+------------------------------------------------- -----------------------------
+bench0 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
diff --git a/cli/tests/testdata/bench/file_protocol.ts b/cli/tests/testdata/bench/file_protocol.ts
new file mode 100644
index 000000000..06a07bb38
--- /dev/null
+++ b/cli/tests/testdata/bench/file_protocol.ts
@@ -0,0 +1 @@
+Deno.bench("bench0", () => {});
diff --git a/cli/tests/testdata/test/file_protocol.out b/cli/tests/testdata/test/file_protocol.out
new file mode 100644
index 000000000..252165950
--- /dev/null
+++ b/cli/tests/testdata/test/file_protocol.out
@@ -0,0 +1,6 @@
+Check file://[WILDCARD]/test/file_protocol.ts
+running 1 test from ./test/file_protocol.ts
+test 0 ... ok ([WILDCARD])
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
+
diff --git a/cli/tests/testdata/test/file_protocol.ts b/cli/tests/testdata/test/file_protocol.ts
new file mode 100644
index 000000000..79128c2b3
--- /dev/null
+++ b/cli/tests/testdata/test/file_protocol.ts
@@ -0,0 +1 @@
+Deno.test("test 0", () => {});