diff options
| author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-03-11 23:07:02 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-11 23:07:02 +0100 |
| commit | 09ae512ccb4d8a36a0c6c1a700b48fdd3f9fc6c2 (patch) | |
| tree | 90f5bc5a9d48f5279208eecf985dcf7f777e87c5 /cli/tests/integration | |
| parent | 32c059544be40987a445f13cc3c7ba585f47889e (diff) | |
feat: "deno bench" subcommand (#13713)
This commit adds "deno bench" subcommand and "Deno.bench()"
API that allows to register bench cases.
The API is modelled after "Deno.test()" and "deno test" subcommand.
Currently the output is rudimentary and bench cases and not
subject to "ops" and "resource" sanitizers.
Co-authored-by: evan <github@evan.lol>
Diffstat (limited to 'cli/tests/integration')
| -rw-r--r-- | cli/tests/integration/bench_tests.rs | 135 | ||||
| -rw-r--r-- | cli/tests/integration/mod.rs | 2 |
2 files changed, 137 insertions, 0 deletions
diff --git a/cli/tests/integration/bench_tests.rs b/cli/tests/integration/bench_tests.rs new file mode 100644 index 000000000..06806c0b7 --- /dev/null +++ b/cli/tests/integration/bench_tests.rs @@ -0,0 +1,135 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. + +use crate::itest; + +itest!(overloads { + args: "bench --unstable bench/overloads.ts", + exit_code: 0, + output: "bench/overloads.out", +}); + +itest!(meta { + args: "bench --unstable bench/meta.ts", + exit_code: 0, + output: "bench/meta.out", +}); + +itest!(pass { + args: "bench --unstable bench/pass.ts", + exit_code: 0, + output: "bench/pass.out", +}); + +itest!(ignore { + args: "bench --unstable bench/ignore.ts", + exit_code: 0, + output: "bench/ignore.out", +}); + +itest!(ignore_permissions { + args: "bench --unstable bench/ignore_permissions.ts", + exit_code: 0, + output: "bench/ignore_permissions.out", +}); + +itest!(fail { + args: "bench --unstable bench/fail.ts", + exit_code: 1, + output: "bench/fail.out", +}); + +itest!(collect { + args: "bench --unstable --ignore=bench/collect/ignore bench/collect", + exit_code: 0, + output: "bench/collect.out", +}); + +itest!(load_unload { + args: "bench --unstable bench/load_unload.ts", + exit_code: 0, + output: "bench/load_unload.out", +}); + +itest!(interval { + args: "bench --unstable bench/interval.ts", + exit_code: 0, + output: "bench/interval.out", +}); + +itest!(quiet { + args: "bench --unstable --quiet bench/quiet.ts", + exit_code: 0, + output: "bench/quiet.out", +}); + +itest!(only { + args: "bench --unstable bench/only.ts", + exit_code: 1, + output: "bench/only.out", +}); + +itest!(no_check { + args: "bench --unstable --no-check bench/no_check.ts", + exit_code: 1, + output: "bench/no_check.out", +}); + +itest!(allow_all { + args: "bench --unstable --allow-all bench/allow_all.ts", + exit_code: 0, + output: "bench/allow_all.out", +}); + +itest!(allow_none { + args: "bench --unstable bench/allow_none.ts", + exit_code: 1, + output: "bench/allow_none.out", +}); + +itest!(exit_sanitizer { + args: "bench --unstable bench/exit_sanitizer.ts", + output: "bench/exit_sanitizer.out", + exit_code: 1, +}); + +itest!(clear_timeout { + args: "bench --unstable bench/clear_timeout.ts", + exit_code: 0, + output: "bench/clear_timeout.out", +}); + +itest!(finally_timeout { + args: "bench --unstable bench/finally_timeout.ts", + exit_code: 1, + output: "bench/finally_timeout.out", +}); + +itest!(unresolved_promise { + args: "bench --unstable bench/unresolved_promise.ts", + exit_code: 1, + output: "bench/unresolved_promise.out", +}); + +itest!(unhandled_rejection { + args: "bench --unstable bench/unhandled_rejection.ts", + exit_code: 1, + output: "bench/unhandled_rejection.out", +}); + +itest!(filter { + args: "bench --unstable --filter=foo bench/filter", + exit_code: 0, + output: "bench/filter.out", +}); + +itest!(no_prompt_by_default { + args: "bench --unstable bench/no_prompt_by_default.ts", + exit_code: 1, + output: "bench/no_prompt_by_default.out", +}); + +itest!(no_prompt_with_denied_perms { + args: "bench --unstable --allow-read bench/no_prompt_with_denied_perms.ts", + exit_code: 1, + output: "bench/no_prompt_with_denied_perms.out", +}); diff --git a/cli/tests/integration/mod.rs b/cli/tests/integration/mod.rs index 8d934dc0f..98b203ee9 100644 --- a/cli/tests/integration/mod.rs +++ b/cli/tests/integration/mod.rs @@ -50,6 +50,8 @@ macro_rules! itest_flaky( // the test (ex. `lint_tests.rs`) and which is the implementation (ex. `lint.rs`) // when both are open, especially for two tabs in VS Code +#[path = "bench_tests.rs"] +mod bench; #[path = "bundle_tests.rs"] mod bundle; #[path = "cache_tests.rs"] |
