summaryrefslogtreecommitdiff
path: root/cli/js/testing.ts
AgeCommit message (Collapse)Author
2020-07-19Port internal TS code to JS (#6793)Bartek Iwańczuk
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-07-14Use dprint for internal formatting (#6682)David Sherret
2020-07-11feat(Deno.inspect): Add sorted, trailingComma, compact and iterableLimit to ↵Nayeem Rahman
InspectOptions (#6591)
2020-07-07feat(test): Add support for regex in filter flag (#6343)Sebastien Filion
Currently, the documentation makes it sound like the test subcommand's filter flag could accept some kind of pattern matching value like a glob or a regex, although the function "createFilterFn" accepts a regex as an argument, there's no way to pass an actual regex value from the CLI. This commit makes it possible to pass a string that could be cast as regex when string matches "^/.*/$". With this change, a user can use the filter flag as follow: deno test --filter "/test-.+/" Also tested that `\` get escaped properly, on MacOS at least, and this is also a valid flag: deno test --filter "/test-\d+/"
2020-07-06clean up code in cli/js (#6611)Stanislav
2020-06-19fix: "deno test" should respect NO_COLOR=true (#6371)uki00a
2020-06-12feat: Add TestDefinition::only (#5793)Nayeem Rahman
2020-06-02fix: Better use of @ts-expect-error (#6038)Kitson Kelly
2020-05-26Use ts-expect-error instead of ts-ignore. (#5869)Kitson Kelly
2020-04-28BREAKING: remove overload of Deno.test() (#4951)Bartek Iwańczuk
This commit removes overload of Deno.test() that accepted named function.
2020-04-27BREAKING: remove Deno.runTests() API (#4922)Bartek Iwańczuk
Deno.runTests() interface is not yet good enough to be exposed publicly with stability guarantees. This commit removes public API related to testing: Deno.runTests() and Deno.TestMessage, but keeps them exposed on Deno.internal object so they can be used with "deno test" subcommand.
2020-04-25add help messages to Deno.test() sanitizers (#4887)Bartek Iwańczuk
2020-04-23refactor(cli/js/testing): Rename disableOpSanitizer to sanitizeOps (#4854)Nayeem Rahman
* rename disableOpSanitizer to sanitizeOps * rename disableResourceSanitizer to sanitizeResources
2020-04-03fix: async ops sanitizer false positives in timers (#4602)Bartek Iwańczuk
2020-04-02feat: deno test --filter (#4570)Ryan Dahl
2020-04-01refactor(cli/js/testing): Reduce testing interfaces (#4451)Nayeem Rahman
* Reduce "testing" interfaces * Use a callback instead of a generator for Deno.runTests() * Default RunTestsOptions::reportToConsole to true * Compose TestMessage into a single interface
2020-03-28Update to Prettier 2 and use ES Private Fields (#4498)Kitson Kelly
2020-03-20Add require-await lint rule (#4401)Samrith Shankar
2020-03-19refactor: rename Deno.TestDefinition.skip to ignore (#4400)Bartek Iwańczuk
2020-03-18feat: Deno.test() sanitizes ops and resources (#4399)Bartek Iwańczuk
This PR brings assertOps and assertResources sanitizers to Deno.test() API. assertOps checks that test doesn't leak async ops, ie. there are no unresolved promises originating from Deno APIs. Enabled by default, can be disabled using Deno.TestDefinition.disableOpSanitizer. assertResources checks that test doesn't leak resources, ie. all resources used in test are closed. For example; if a file is opened during a test case it must be explicitly closed before test case finishes. It's most useful for asynchronous generators. Enabled by default, can be disabled using Deno.TestDefinition.disableResourceSanitizer. We've used those sanitizers in internal runtime tests and it proved very useful in surfacing incorrect tests which resulted in interference between the tests. All tests have been sanitized. Closes #4208
2020-03-15refactor: change test reporter output (#4371)Bartek Iwańczuk
This commit changes output of default test reporter to resemble output from Rust test runner; first the name of running test is printed with "...", then after test has run result is printed on the same line. * Split "Deno.TestEvent.Result" into "TestStart" and "TestEnd"; * changes TestReporter interface to support both events; Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-03-15feat(cli/js/testing): Add TestDefinition::skip (#4351)Nayeem Rahman
2020-03-13refactor: unit test runner communicates using TCP socket (#4336)Bartek Iwańczuk
Rewrites "cli/js/unit_test_runner.ts" to communicate with spawned subprocesses using TCP socket. * Rewrite "Deno.runTests()" by factoring out testing logic to private "TestApi" class. "TestApi" implements "AsyncIterator" that yields "TestEvent"s, which is an interface for different types of event occuring during running tests. * Add "reporter" argument to "Deno.runTests()" to allow users to provide custom reporting mechanism for tests. It's represented by "TestReporter" interface, that implements hook functions for each type of "TestEvent". If "reporter" is not provided then default console reporting is used (via "ConsoleReporter"). * Change how "unit_test_runner" communicates with spawned suprocesses. Instead of parsing text data from child's stdout, a TCP socket is created and used for communication. "unit_test_runner" can run in either "master" or "worker" mode. Former is responsible for test discovery and establishing needed permission combinations; while latter (that is spawned by "master") executes tests that match given permission set. * Use "SocketReporter" that implements "TestReporter" interface to send output of tests to "master" process. Data is sent as stringified JSON and then parsed by "master" as structured data. "master" applies it's own reporting logic to output tests to console (by reusing default "ConsoleReporter").
2020-03-11reorg: cli/js/compiler/, move more API to cli/js/web/ (#4310)Bartek Iwańczuk
- moves compiler implementation to "cli/js/compiler/" directory - moves more APIs to "cli/js/web": * "console.ts" * "console_table.ts" * "performance.ts" * "timers.ts" * "workers.ts" - removes some dead code from "cli/js/"
2020-03-08reorg: move JS ops implementations to cli/js/ops/, part 1 (#4264)Bartek Iwańczuk
Following JS ops were moved to separate files in cli/js/ops directory: - compiler - dispatch_json - dispatch_minimal - errors - fetch - fs_events - os - random - repl - resources - runtime_compiler - runtime - tty
2020-03-05refactor: preliminary cleanup of Deno.runTests() (#4237)Bartek Iwańczuk
* refactor: preliminary cleanup of Deno.runTests() * Change time measurement to use new Date() instead of performance.now(). Because there is no guarantee that tests are run with "--allow-hr" using new Date() guarantees higher precision of 1ms instead of 2ms. * Support String type filter in "skip" and "only". * Split "exitOnFail" into "exitOnFail" and "failFast". Former tells if "runTests()" should exit with code 1 on test failure, while latter tells if "runTests()" should stop running tests on first failure. * Use "defer" to wait for unhandled promise rejection - this bit is funky and doesn't seem right, but for now it's just a rewrite from using "setTimeout". Intended to be fixed in later commits. * Remove global "__DENO_TEST_REGISTRY", don't expose list of registered tests (to be addressed in follow up commits) * Remove arbitrary slow test threshold; use uniform coloring instead
2020-02-11refactor: rewrite deno test, add Deno.test() (#3865)Bartek Iwańczuk
* rewrite test runner in Rust * migrate "test" and "runTests" functions from std to "Deno" namespace * use "Deno.test()" to run internal JS unit tests * remove std downloads for Deno subcommands