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

test(cli): run unit tests using Deno.test #10330

Conversation

caspervonb
Copy link
Contributor

This removes the old unit test runner and migrates all unit tests to run with deno test instead.

@caspervonb

This comment has been minimized.

@caspervonb caspervonb force-pushed the test-use-deno-test-internally-for-unit-tests branch 3 times, most recently from d8afb36 to b561be2 Compare April 26, 2021 06:55
@caspervonb caspervonb closed this Apr 26, 2021
@caspervonb caspervonb reopened this Apr 26, 2021
@caspervonb caspervonb force-pushed the test-use-deno-test-internally-for-unit-tests branch from 2094d75 to 98a2b3f Compare April 26, 2021 08:09
@caspervonb caspervonb force-pushed the test-use-deno-test-internally-for-unit-tests branch 4 times, most recently from 81b830b to e254be2 Compare April 26, 2021 10:32
@caspervonb caspervonb force-pushed the test-use-deno-test-internally-for-unit-tests branch from a951135 to 6724bf5 Compare April 26, 2021 11:03
@caspervonb
Copy link
Contributor Author

caspervonb commented Apr 26, 2021

WebGPU test is leaking because destroy seemingly doesn't seem to close the resources it owns.
After destroy is called, the resource keys are:

[ "0", "1", "2", "973", "982", "984" ]

See run https://github.com/denoland/deno/runs/2437592943

I've disabled the test for now.

@bartlomieju
Copy link
Member

WebGPU test is leaking because destroy seemingly doesn't seem to close the resources it owns.
After destroy is called, the resource keys are:

[ "0", "1", "2", "973", "982", "984" ]

See run https://github.com/denoland/deno/runs/2437592943

I've disabled the test for now.

It's a bit disconcerting that it started failing after this change

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

@caspervonb is there anything preventing us from removing unitTest wrapper completely? I know that it'll be painful and a huge diff, but asking out of curiosity

Comment on lines 1 to 12
# Deno runtime tests

Files in this directory are unit tests for Deno runtime.

Testing Deno runtime code requires checking API under different runtime
permissions (ie. running with different `--allow-*` flags). To accomplish this
all tests exercised are created using `unitTest()` function.

```ts
import { unitTest } from "./test_util.ts";

unitTest(function simpleTestFn(): void {
Copy link
Member

Choose a reason for hiding this comment

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

I'd be great to keep this README file, it's especially useful to look up command to run a single test. Please retain it and update the examples.

await runTests({ filter });
}

main();
Copy link
Member

Choose a reason for hiding this comment

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

Great to see it go

@caspervonb
Copy link
Contributor Author

@caspervonb is there anything preventing us from removing unitTest wrapper completely? I know that it'll be painful and a huge diff, but asking out of curiosity

Nothing preventing it, we can remove it completely in a follow-up.
Preferably once we've decided if we want an options bag overload or not.

@bartlomieju
Copy link
Member

@caspervonb is there anything preventing us from removing unitTest wrapper completely? I know that it'll be painful and a huge diff, but asking out of curiosity

Nothing preventing it, we can remove it completely in a follow-up.
Preferably once we've decided if we want an options bag overload or not.

Is the option bag required for that? IIRC most of the tests are already written using single option bag.

@caspervonb
Copy link
Contributor Author

Is the option bag required for that? IIRC most of the tests are already written using single option bag.

Not required, just nicer imho.
Most unit tests are in this form:

unitTest("foobla", {
  perms: { read: false, write: true },
}, function() {
  // ...
});

@bartlomieju
Copy link
Member

Is the option bag required for that? IIRC most of the tests are already written using single option bag.

Not required, just nicer imho.
Most unit tests are in this form:

unitTest("foobla", {
  perms: { read: false, write: true },
}, function() {
  // ...
});

I see, thanks for the heads up!

@lucacasonato lucacasonato force-pushed the test-use-deno-test-internally-for-unit-tests branch from d0e5c96 to 20f811f Compare April 27, 2021 09:17
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM, exciting!

@bartlomieju bartlomieju merged commit 3a03084 into denoland:main Apr 27, 2021
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.

3 participants