diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-03-19 14:26:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-19 14:26:47 +0100 |
commit | 8de4a05f2a93f194f71b959f4d47a1b4fc61aa41 (patch) | |
tree | c2e0a4ad75fe5d4d05d30e495fa7106a297c741c /cli/tests | |
parent | 5b10ab0984fd762c14caf524d59ec8b6940d2bfb (diff) |
fix: std/testing/runner.ts and deno test (#4392)
After splitting "failFast" and "exitOnFail" arguments, there was a situation where failing tests did not exit with code 1.
* fixed argument value passed to Deno.runTests() in deno test
* fixed argument value passed to Deno.runTests() in std/testing/runner.ts
* added integration tests for deno test to ensure failFast and exitOnFail work as expected
* don't write test file to file system, but keep it in memory
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/deno_test.out | 25 | ||||
-rw-r--r-- | cli/tests/deno_test_fail_fast.out | 14 | ||||
-rw-r--r-- | cli/tests/integration_tests.rs | 12 | ||||
-rw-r--r-- | cli/tests/test_runner_test.ts | 19 |
4 files changed, 70 insertions, 0 deletions
diff --git a/cli/tests/deno_test.out b/cli/tests/deno_test.out new file mode 100644 index 000000000..8fe589613 --- /dev/null +++ b/cli/tests/deno_test.out @@ -0,0 +1,25 @@ +running 4 tests +test fail1 ... FAILED [WILDCARD] +test fail2 ... FAILED [WILDCARD] +test success1 ... ok [WILDCARD] +test fail3 ... FAILED [WILDCARD] + +failures: + +fail1 +AssertionError: fail1 assertion +[WILDCARD] + +fail2 +AssertionError: fail2 assertion +[WILDCARD] + +fail3 +AssertionError: fail3 assertion +[WILDCARD] + +failures: +[WILDCARD] + +test result: FAILED. 1 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD] + diff --git a/cli/tests/deno_test_fail_fast.out b/cli/tests/deno_test_fail_fast.out new file mode 100644 index 000000000..f4d111bcc --- /dev/null +++ b/cli/tests/deno_test_fail_fast.out @@ -0,0 +1,14 @@ +running 4 tests +test fail1 ... FAILED [WILDCARD] + +failures: + +fail1 +AssertionError: fail1 assertion +[WILDCARD] + +failures: +[WILDCARD] + +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD] + diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 29203d411..51f849ff6 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -899,6 +899,18 @@ itest!(_026_redirect_javascript { http_server: true, }); +itest!(deno_test_fail_fast { + args: "test --failfast test_runner_test.ts", + exit_code: 1, + output: "deno_test_fail_fast.out", +}); + +itest!(deno_test { + args: "test test_runner_test.ts", + exit_code: 1, + output: "deno_test.out", +}); + itest!(workers { args: "test --reload --allow-net workers_test.ts", http_server: true, diff --git a/cli/tests/test_runner_test.ts b/cli/tests/test_runner_test.ts new file mode 100644 index 000000000..006eca07c --- /dev/null +++ b/cli/tests/test_runner_test.ts @@ -0,0 +1,19 @@ +// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. + +import { assert } from "../../std/testing/asserts.ts"; + +Deno.test(function fail1() { + assert(false, "fail1 assertion"); +}); + +Deno.test(function fail2() { + assert(false, "fail2 assertion"); +}); + +Deno.test(function success1() { + assert(true); +}); + +Deno.test(function fail3() { + assert(false, "fail3 assertion"); +}); |