summaryrefslogtreecommitdiff
path: root/cli/tests
AgeCommit message (Collapse)Author
2020-03-19perf: Optimize TextEncoder and TextDecoder (#4430)Bartek Iwańczuk
* add tests for "Deno.core.encode" and "Deno.core.decode" for empty inputs * use "Deno.core.encode" in "TextEncoder" * use "Deno.core.decode" in "TextDecoder" * remove "core_decode" and "core_encode" benchmarks
2020-03-19Fix cafile_install_remote_module test (#4429)Ryan Dahl
2020-03-19remove std/testing/runner.ts, use deno test for std/ tests (#4397)Bartek Iwańczuk
This introduces BREAKING CHANGE by removing "std/testing/runner.ts". Std tests are now run using "deno test" subcommand.
2020-03-19fix: std/testing/runner.ts and deno test (#4392)Bartek Iwańczuk
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
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-18Provide compiled JSON to TypeScript compiler. (#4404)Kitson Kelly
Fixes #4101 Previously, we would just provide the raw JSON to the TypeScript compiler worker, but TypeScript does not transform JSON. This caused a problem when emitting a bundle, that the JSON would just be "inlined" into the output, instead of being transformed into a module. This fixes this problem by providing the compiled JSON to the TypeScript compiler, so TypeScript just sees JSON as a "normal" TypeScript module.
2020-03-17try to handle ConnectionReset error in windows CI for unit tests (#4407)Bartek Iwańczuk
2020-03-16console: Symbol.toStringTag and display Object symbol entries (#4388)Kevin (Kun) "Kassimo" Qian
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: Deno.core.{encode,decode}; standalone UTF-8 encoding/decoding (#4349)Bartek Iwańczuk
This commits add two new methods to "Deno.core" namespace: "encode" and "decode". Those methods are bound in Rust to provide a) fast b) generally available of encoding and decoding UTF-8 strings. Both methods are now used in "cli/js/dispatch_json.ts".
2020-03-15Remove Object.prototype.__proto__ (#4341)Kitson Kelly
2020-03-15feat(cli/js/testing): Add TestDefinition::skip (#4351)Nayeem Rahman
2020-03-14Update CLI for unit_test_runner.ts (#4352)Bartek Iwańczuk
* drop server guard before unit test result check To prevent cascading test failures when js_unit_test http server guard is dropped before asserting that tests were successful. This is really a band-aid and doesn't solve underlying issue with http server. * Update CLI for unit_test_runner.ts * Change cli/js/tests/unit_test_runner.ts command line interface to work in 3 modes: - "one-off" - run tests that match permissions of currently running process - "master" - run tests for all possible permission combinations, by spawning subprocesses running in "worker" mode and communicating via TCP socket; requires elevated permissions - "worker" - run tests for set of permissions provided by CLI arg; requires elevated permissions to setup TCP connection to "master"; after initial setup process drops permissions to given set * Support filtering of tests by string passed after "--" CLI arg * Update cli/js/tests/README.md
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-12Enable std tests in debug mode (#4332)Ryan Dahl
2020-03-11Add waker to StreamResource to fix hang on close bugs (#4293)João Souto
2020-03-11move compiler API tests to integration tests (#4319)Bartek Iwańczuk
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-10reorg: move js runtime tests to cli/js/tests/ (#4250)Bartek Iwańczuk
All Deno runtime test files were moved to cli/js/tests/ directory. It makes a clear distinction that cli/js/tests/ contains code that is run under Deno runtime as opposed to code in cli/js/ which is used to create bundle and snapshot with "deno_typescript".
2020-03-08disable test_raw_tty (#4282)Yusuke Sakurai
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-07Improve run_and_collect_output (#4272)Ryan Dahl
* Fix flaky test test_permissions_net_listen_allow_localhost * Improve error reporting for run_and_collect_output
2020-03-06Fix flaky test test_permissions_net_listen_allow_localhost (#4271)Ryan Dahl
2020-03-06Add content type for wasm, fix encoding in wasm test fixture (#4269)Aurélien Bertron
2020-03-05Allow BadResource errors to take a custom message (#4251)Ryan Dahl
2020-03-04Migrate internal bundles to System (#4233)Kitson Kelly
2020-03-04Fix `deno install` file name including extra dot on Windows (#4243)yuta0801
2020-03-03Disable flaky and broken tests (#4239)Ryan Dahl
2020-03-03add assertOps sanitizer in cli/js/ unit tests (#4209)Bartek Iwańczuk
* add "assertOps" test assertion which makes sure test case is not "leaking" ops - ie. after test finishes there are no pending async ops * apply "assertOps" to all tests in "cli/js/" * fix numerous tests leaking ops * document problem with edge case in "clearInterval" and "clearTimeout" implementation where they may leak async ops * move "cli/js/worker_test.ts" to "cli/tests/worker_test.ts" and run as integration test; workers leak ops because of missing "terminate" implementation
2020-03-02Fix JavaScript dependencies in bundles. (#4215)Kitson Kelly
Fixes #4602 We turned off `allowJs` by default, to keep the compiler from grabbing a bunch of files that it wouldn't actually do anything useful with. On the other hand, this caused problems with bundles, where the compiler needs to gather all the dependencies, including JavaScript ones. This fixes this so that when we are bundling, we analyse JavaScript imports in the compiler.
2020-03-01Port Complex Permissions Tests to Rust (#4200)João Souto
2020-02-29refactor(cli/js): Replace constructError() with getErrorClass() (#4189)Nayeem Rahman
Flattens dispatch error handling to produce one less useless stack frame on op errors.
2020-02-28rewrite permission revoke test as integration test (#4164)Bartek Iwańczuk
2020-02-28Support TypeScript eval through `deno eval -T` flag (#4141)Kevin (Kun) "Kassimo" Qian
2020-02-27Return non-zero exit code on malformed stdin fmt (#4163)Ryan Dahl
2020-02-27feat: Support types compiler option in compiler APIs (#4155)Kitson Kelly
Handles `types` in the compiler APIs to make it easier to supply external type libraries.
2020-02-26Bundles can be sync or async based on top level await (#4124)Kitson Kelly
Previously, bundles always utilised top level await, even if the bundled modules didn't require top level await. Now, analysis of the bundle is done and if none of the bundled modules are asynchronously executed, then the bundle as a whole will be synchronously executed. Fixes #4055 Fixes #4123
2020-02-26DenoFlags -> Flags (#4136)Ryan Dahl
2020-02-26tty: Deno.setRaw(rid, mode) to turn on/off raw mode (#3958)Kevin (Kun) "Kassimo" Qian
2020-02-25Port permission_prompt_tests to Rust (#4129)João Souto
2020-02-25upgrade: TypeScript 3.8 (#4100)Kitson Kelly
2020-02-25fix: Resolve makeTemp* paths from CWD (#4104)Nayeem Rahman
2020-02-25Fix issues with JavaScript importing JavaScript. (#4120)Kitson Kelly
Fixes #3852 Fixes #4117
2020-02-24port tools/repl_test.py to Rust (#4096)João Souto
ref #2988
2020-02-24fix: createSecKey logic (#4063)Suguru Motegi
2020-02-23feat: support brotli compression for fetch API (#4082)EnokMan
2020-02-21refactor: remove unneeded ErrorKinds (#3936)Bartek Iwańczuk
2020-02-21fix: add io ops to worker to fix fetch (#4054)Bartek Iwańczuk
2020-02-19fix: mis-detecting imports on JavaScript when there is no checkJs (#4040)Kitson Kelly
This PR fixes an issue where we recursively analysed imports on plain JS files in the compiler irrespective of "checkJs" being true. This caused problems where when analysing the imports of those files, we would mistake some import like structures (AMD/CommonJS) as dependencies and try to resolve the "modules" even though the compiler would not actually look at those files.
2020-02-19fix: emit when bundle contains single module (#4042)Kitson Kelly
Fixes #4031 When a bundle contains a single module, we were incorrectly determining the module name, resulting in a non-functional bundle. This PR corrects that determination.