Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CLI for unit_test_runner.ts #4352

Merged
merged 3 commits into from
Mar 14, 2020

Conversation

bartlomieju
Copy link
Member

Ref #4345

See commit messages for details

Addresses:

When running "cargo test" and the js_unit_tests fails, it causes a cascade of other test failures. This is related to how the tools/http_server.py is shut down.

People who are adding features need a quick guide and shouldn't have to read through the increasingly complex test runner code. Add information to cli/js/tests/README.md:
how to run specific tests
how to get raw stdout/stderr of tests.
how to run tests with specific permissions, avoiding the test runner parent process.

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.

// run tests with "net" permission deno --allow-net unit_test_runner.ts

deno --allow-net --allow-read unit_test_runner.ts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commands would be more useful from the root of the project directory and using target/debug/deno explicitly. Then I could copy and paste :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, just thought about it!

* 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
Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice - LGTM

@bartlomieju bartlomieju merged commit d6bbbdd into denoland:master Mar 14, 2020
@bartlomieju bartlomieju deleted the unit_test_runner_part2 branch March 14, 2020 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants