1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-01 09:24:20 -04:00
Commit graph

182 commits

Author SHA1 Message Date
Bartek Iwańczuk
4a4894532e
try to handle ConnectionReset error in windows CI for unit tests (#4407) 2020-03-17 17:35:38 -04:00
crowlKats
9833975ef2
feat: fetch should accept a FormData body (#4363) 2020-03-17 02:32:43 -04:00
dubiousjim
f9557a4ff6
Add mode option to open/create (#4289) 2020-03-16 15:02:41 -04:00
Bartek Iwańczuk
0d14a7bd53
try to fix unit test runner on Windows (#4395)
This PR attempts to fix intermittent errors occurring on Windows for "cli/tests/unit_test_runner.ts." Runner has been reworked to create only single TCP listener instead of one listener per worker.
Additionally worker doesn't close TCP socket - it waits for parent process to close the socket and only then exits.
2020-03-16 16:50:58 +01:00
Bartek Iwańczuk
7d0b77440e
fix: fetch closes unused body (#4393)
This commit makes sure that "httpBody" resource is closed in case of redirections in fetch API.
2020-03-16 15:32:29 +01:00
Kevin (Kun) "Kassimo" Qian
49541a04d2
console: Symbol.toStringTag and display Object symbol entries (#4388) 2020-03-16 09:05:39 -04:00
Bartek Iwańczuk
1edb20b399
refactor: add no-return-await lint rule (#4384) 2020-03-16 10:22:16 +01:00
Bartek Iwańczuk
70434b5bfb
refactor: change test reporter output (#4371)
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-15 17:58:59 +01:00
Bartek Iwańczuk
dc6e0c3591
feat: Deno.core.{encode,decode}; standalone UTF-8 encoding/decoding (#4349)
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-15 15:31:55 +01:00
Kitson Kelly
2f4be6e944
Remove Object.prototype.__proto__ (#4341) 2020-03-15 11:34:22 +01:00
Nayeem Rahman
64a35acd64
feat(cli/js/testing): Add TestDefinition::skip (#4351) 2020-03-15 10:34:24 +01:00
dubiousjim
6cc40b0865
BREAKING CHANGE FileInfo.len renamed to FileName.size (#4338) 2020-03-14 22:57:42 -04:00
Bartek Iwańczuk
d6bbbdda75
Update CLI for unit_test_runner.ts (#4352)
* 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-14 11:53:20 +01:00
Bartek Iwańczuk
aab1acaed1
refactor: unit test runner communicates using TCP socket (#4336)
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-13 15:57:32 +01:00
crowlKats
e435c2be15
Remove doc strings from cli/js TS files (#4329)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-03-13 10:22:22 +01:00
João Souto
fb5c31416d
Add waker to StreamResource to fix hang on close bugs (#4293) 2020-03-11 18:19:24 -04:00
Bartek Iwańczuk
810e4a16be
reorg: Deno global initialization (#4317) 2020-03-11 21:57:24 +01:00
Bartek Iwańczuk
b8fa3fd5e7
move compiler API tests to integration tests (#4319) 2020-03-11 21:54:53 +01:00
dubiousjim
a28fa2415f
support permission mode in mkdir (#4286) 2020-03-11 16:14:23 -04:00
dubiousjim
72c408ea9d
Stricter permissions for Deno.makeTemp* (#4318) 2020-03-11 15:05:42 -04:00
Bartek Iwańczuk
2d1b39bef3
reorg: remove dispatch.ts, move signals, factor out web utils (#4316)
- moves signal definition from "cli/js/process.ts" to "cli/js/signals.ts"
- removes "cli/js/dispatch.ts"
- removes "cli/js/types.ts"
- moves web specific utilities to "cli/js/web/util.ts"
2020-03-11 15:49:53 +01:00
Bartek Iwańczuk
99a0c6df79
reorg: cli/js/compiler/, move more API to cli/js/web/ (#4310)
- 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-11 10:53:06 +01:00
Nayeem Rahman
55119aaee2
refactor(cli/js/net): Cleanup iterable APIs (#4236)
Listener and UDPConn are AsyncIterables instead of AsyncIterators.
The [Symbol.asyncIterator]()s are defined as generators and the
next() methods are gone.

"Listener/Socket has been closed" errors are now BadResource.
2020-03-10 15:14:22 -04:00
dubiousjim
8078d976d2
Add Deno.umask (#4290) 2020-03-10 15:11:27 -04:00
Nayeem Rahman
6443e4aed1
refactor: Cleanup options object parameters (#4296) 2020-03-10 12:08:58 -04:00
Bartek Iwańczuk
fbc4731256
refactor: uncomment tests broken tests, use skip (#4311)
* uncomment broken tests, use skip:
- net_test.ts 
- url_test.ts
- fetch_test.ts
2020-03-10 16:38:02 +01:00
Bartek Iwańczuk
dca00211ab
use Object instead of Map for promise table (#4309) 2020-03-09 22:04:49 -04:00
Bartek Iwańczuk
68119e1d7e
reorg: move js runtime tests to cli/js/tests/ (#4250)
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-10 01:06:47 +01:00
Bartek Iwańczuk
b7eb241c35
reorg: move JS ops implementations to cli/js/ops/, part 3 (#4302)
Following JS ops were moved to separate files in cli/js/ops directory:
- net
- tls
- fs
2020-03-10 00:22:15 +01:00
Bartek Iwańczuk
886f330ec8
reorg: move JS ops implementations to cli/js/ops/, part 2 (#4283)
Following JS ops were moved to separate files in cli/js/ops directory:
- io
- process
- worker_host
- web_worker
- plugins
- timers
- signal
- permissions
2020-03-09 15:18:02 +01:00
Bartek Iwańczuk
1b6f831875
reorg: move JS ops implementations to cli/js/ops/, part 1 (#4264)
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-08 13:09:22 +01:00
dubiousjim
0dd131d4a5
Rename perm to mode (#4276)
There's a lot of variation in doc comments and internal code about
whether chmod/0o777-style permissions are called `mode` or `perm`. (For
example, mkdir and writeFile choose differently.)

Had proposed earlier to go consistently with `perm`, but on balance devs
prefer to go with `mode`.
2020-03-07 22:29:12 -05:00
dubiousjim
acf0958e94
Rename name/filename arguments to path (#4227)
There's a lot of variation in doc comments and internal code about
whether the first parameter to file system calls is `path` or `name` or
`filename`. For consistency, have made it always be `path`.
2020-03-06 11:29:23 -05:00
dubiousjim
9a63902db5
Rename readDir -> readdir (#4225) 2020-03-06 08:34:02 -05:00
Bartek Iwańczuk
2e59007214 move Web APIs to cli/js/web/ 2020-03-05 18:48:55 +01:00
Bartek Iwańczuk
9b59ed7c79 fix event target tests 2020-03-05 11:09:04 -05:00
Ryan Dahl
c850b258b4
Support async function and EventListenerObject as listeners (#4240) 2020-03-05 08:36:13 -05:00
Bartek Iwańczuk
20dad3659c
refactor: preliminary cleanup of Deno.runTests() (#4237)
* 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-03-05 11:52:18 +01:00
Bartek Iwańczuk
52b96fc22a
refactor: cleanup compiler runtimes (#4230)
- Cleanup "tsCompilerOnMessage" by factoring out separate methods for each 
  request type:
    * "compile"
    * "runtimeCompile"
    * "runtimeTranspile"
- Simplify control flow of compiler workers by a) no longer calling "close()" in worker runtime after a
single message; b) explicitly shutting down worker from host after a single message

Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-03-05 11:13:10 +01:00
Ryan Dahl
a1b98e9e6a
Remove Deno.errors.Other (#4249) 2020-03-04 13:18:32 -05:00
Bartek Iwańczuk
8d96dffa41
refactor: rewrite testPerm into unitTest (#4231)
Rewrite "testPerm" helper function used for testing of internal 
runtime code. It's been renamed to "unitTest" and provides API that
is extensible in the future by accepting optional "UnitTestOptions" 
argument. "test" helper was also removed and replaced by
overloaded version of "unitTest" that takes only function argument.

"UnitTestOptions" currently supports "perms" and "skip"
options, where former works exactly as first argument to "testPerm"
did, while the latter allows to conditionally skip tests.
2020-03-04 17:31:14 +01:00
Kitson Kelly
30682cf74f
Migrate internal bundles to System (#4233) 2020-03-04 14:26:00 +01:00
Bartek Iwańczuk
ee452ad883
add assertOps sanitizer in cli/js/ unit tests (#4209)
* 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-03 18:22:53 +01:00
Yusuke Sakurai
4dc004f0a2
misc: reduce unnecesarry output in cli/js tests (#4182)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-03-03 15:51:07 +01:00
Bert Belder
eafd40feab
Do not convert exceptions to JSON and back (#4214) 2020-03-02 14:20:16 -08:00
Kitson Kelly
83d902a780
Fix JavaScript dependencies in bundles. (#4215)
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-02 22:18:27 +01:00
dubiousjim
a3c3a56ff7
Rename Option -> Options (#4226)
* Rename MkdirOption interface to MkdirOptions

It was hard to remember which Options interfaces were spelled in the
singular and which in the plural (and anyway this one contained two
options).

Also added MkdirOptions to cli/js/deno.ts. All the analogous interfaces
were exported there.

* Rename RemoveOption interface to RemoveOptions

This was the last remaining Option interface spelled in the singular.
Easier to remember if they're all Option**s**; plus we may want to add extra
options here later.
2020-03-02 21:24:42 +01:00
Bartek Iwańczuk
ff5bba3be8
feat: update metrics to track different op types (#4221) 2020-03-02 19:13:36 +01:00
bartOssh
4a47ffa5c4
seek should return cursor position (#4211) 2020-03-02 11:44:46 -05:00
dubiousjim
6cd46fa3ef
Cleanup comments and internal variables (#4205) 2020-03-02 10:19:42 -05:00