Commit graph

65 commits

Author SHA1 Message Date
迷渡 9d53a7a523
fix(doc): FileInfo.created is creation time (#4799) 2020-04-18 00:05:33 -04:00
Nayeem Rahman 5ac728a5f1
refactor(cli/js/ops/fs): Improve readdir() and FileInfo interfaces (#4763) 2020-04-16 01:40:30 -04:00
Ryan Dahl fab0204cbf
Make writeSync, readSync, seekSync, openSync, isatty proper synchronous syscalls (#4762) 2020-04-15 20:43:19 -04:00
Nayeem Rahman 95eb6d780c
fix(cli/js/net): Make generator return types iterable (#4661) 2020-04-15 12:44:09 +02:00
Nayeem Rahman 0ea6eb83a9
refactor(core/js_error): Align JSStackFrame with CallSite (#4715)
Renames and adds missing fields to JSStackFrame from CallSite. Fixes #4705.

Cleans up base changes for line and column numbers.
2020-04-13 10:54:16 -04:00
Khải ef76389e42
Convert ProcessStatus to a tagged union (#4732) 2020-04-13 10:46:34 -04:00
迷渡 3a5dae4303
docs: highlight NO_COLOR (#4723) 2020-04-11 23:12:42 -04:00
Chris Knight 2becae884e
BREAKING: Remove deprecated mkdir, mkdirSync APIs (#4615) 2020-04-09 11:15:56 -04:00
dubiousjim c5c3abc517
adjust docs for Deno.seek (#4610) 2020-04-03 13:45:44 -04:00
dubiousjim ce02167c75
Improve tests and docs for Deno.rename (#4597) 2020-04-03 11:00:16 -04:00
dubiousjim 7a9273d9cf
Refactor and expand mkdir tests (#4579) 2020-04-02 14:54:33 -04:00
Ryan Dahl c738797944
feat: deno test --filter (#4570) 2020-04-02 09:26:40 -04:00
Chris Knight 1c30d755bf
better parameter names for a couple functions (#4559) 2020-04-01 12:57:33 -04:00
Nayeem Rahman 270e87d9db
refactor(cli/js/testing): Reduce testing interfaces (#4451)
* 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-04-01 10:47:23 +02:00
Chris Knight 857d96001d
doc: Improve API documentation and add examples (#4548) 2020-03-31 23:21:37 -04:00
Chris Knight e88dcdc5e1
API doc improvments (#4525) 2020-03-29 21:39:10 -04:00
Kitson Kelly bced52505f
Update to Prettier 2 and use ES Private Fields (#4498) 2020-03-28 13:03:49 -04:00
Chris Knight 8bcdb422e3
Improve isatty and kill API docs; Deno.kill() - throw on Windows (#4497) 2020-03-26 15:52:47 -04:00
Chris Knight a053462566
refactor: rename ConsoleOptions to InspectOptions (#4493) 2020-03-25 20:48:47 -04:00
Chris Knight eeedb416c0
doc: improve various API docs and include examples (#4486) 2020-03-24 23:54:41 -04:00
João Souto 70a5034431
feat: Support Unix Domain Sockets (#4176) 2020-03-23 18:02:51 -04:00
Chris Knight a0ba476fee
doc: API improvements to chown, close, compile and connect (#4463) 2020-03-23 00:03:45 -04:00
Ryan Dahl 12ff78ed4c
Remove @url comments from d.ts files (#4449)
These have no function and are not tested, probably incorrect in many
situations.
2020-03-21 17:58:31 -04:00
Akshat Agarwal b8a5c29bf8
BREAKING CHANGE Rename Deno.run's args to cmd (#4444)
This is to avoid confusion with Deno.args which does not include the 
executable to be run.
2020-03-21 17:44:18 -04:00
dubiousjim 77a44163fb
chmod should throw on Windows (#4446) 2020-03-20 16:03:04 -04:00
dubiousjim 69303e2149
refactor: move code from fs.rs into ops/fs.rs (#4428)
This a complex boring PR that shifts around code (primarily) in cli/fs.rs and
cli/ops/fs.rs. The gain of this refactoring is to ease the way for #4188 and
#4017, and also to avoid some future development pain.

Mostly there is no change in functionality. Except:
* squashed bugs where op_utime and op_chown weren't using `resolve_from_cwd`
* eliminated the use of the external `remove_dir_all` crate.
* op_chmod now only queries metadata to verify file/dir exists on Windows (it
  will already fail on Unix if it doesn't)
* op_chown now verifies the file/dir's existence on Windows like chmod does.
2020-03-20 09:46:26 -04:00
Bartek Iwańczuk b0b27c4310
refactor: rename Deno.TestDefinition.skip to ignore (#4400) 2020-03-19 10:58:12 +01:00
Chris Knight 54d1f299dc
Chmod API documentation improvements (#4427) 2020-03-18 21:25:01 -04:00
Chris Knight 2a34cbfaf9
Improve API docs for Deno.bundle and Deno.chdir (#4426) 2020-03-18 19:40:06 -04:00
Bartek Iwańczuk 6e2df8c64f
feat: Deno.test() sanitizes ops and resources (#4399)
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-18 19:25:55 -04:00
dubiousjim f9557a4ff6
Add mode option to open/create (#4289) 2020-03-16 15:02:41 -04: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
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 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
dubiousjim a28fa2415f
support permission mode in mkdir (#4286) 2020-03-11 16:14:23 -04: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
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 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
Ryan Dahl a1b98e9e6a
Remove Deno.errors.Other (#4249) 2020-03-04 13:18:32 -05: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
ecyrbe 2a594bd3b2
feat(std/node): add os.tmpdir() implementation (#4213) 2020-03-01 19:05:04 -05:00
Kitson Kelly 0a51611d76
Clean up lib.deno.ns.d.ts JSDoc (#4170) 2020-02-28 11:05:40 -05:00
Kitson Kelly 1d26da6a47
feat: Support types compiler option in compiler APIs (#4155)
Handles `types` in the compiler APIs to make it easier to supply
external type libraries.
2020-02-27 11:27:00 -05:00