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

Set up AVA for end-to-end tests #1867

Closed
wants to merge 1 commit into from
Closed

Set up AVA for end-to-end tests #1867

wants to merge 1 commit into from

Conversation

NSeydoux
Copy link
Contributor

This is an experiment to see what our end-to-end tests would look like written with AVA. The main reason we would consider changing test frameworks for the end-to-end test is due to the discrepency between the Jest Node environment and the actual Node environment, leading to some subtle and painful-to-debug issues.

A couple of obesrvations:

  • If running the tests in a loop, the test titles must change at each iteration. This will no longer be an issue when the environment will be set by the test matrix.
  • AVA encourages to break tests into smaller files rather than in subtests with "describe" statements.
  • The tests are recompiled when ran, to avoid running stale tests.
  • TS support is quite good: the transliped code runs the tests, but errors are reported in the TS source.

This is an experiment to see what our end-to-end tests would look like written with AVA. The main reason we would consider changing test frameworks for the end-to-end test is due to the discrepency between the Jest Node environment and the actual Node environment, leading to some subtle and painful-to-debug issues.

A couple of obesrvations:
- If running the tests in a loop, the test titles must change at each iteration. This will no longer be an issue when the environment will be set by the test matrix.
- AVA encourages to break tests into smaller files rather than in subtests with "describe" statements.
- The tests are recompiled when ran, to avoid running stale tests.
- TS support is quite good: the transliped code runs the tests, but errors are reported in the TS source.
@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 1a39b27:

Sandbox Source
solid-client-auth-browser-demo Configuration

@matthieubosquet
Copy link
Contributor

I have a vague idea that AVA is better for integration tests and that Jest's node environment has slight differences with node.

But do we have a more specific list of differences between AVA and Jest that would make the decision to move to AVA for e2e tests easier?

@NSeydoux
Copy link
Contributor Author

Not a list of differences between AVA and Jest, but here is a list of bugs related to Jest being slightly misaligned with the regular Node runtime:

The latter contains the core of the issue really.

To summarize:

  • The main motivation to move from Jest to AVA would be to run in a "vanilla" Node runtime to avoid missing or hitting such issues.
  • As far as end-to-end tests are concerned, AVA and Jest have all the required features, so there's no reason to use one over the other at this level.
  • The tests are as readable using one framework or the other
  • Our unit tests are written in Jest and would remain so in the foreseeable future, so moving the end-to-end tests to AVA introduces a new dependency and a different test framework, which is not a big deal but a (small) price to pay still.

@matthieubosquet
Copy link
Contributor

The issue with Jest globals seems pretty bad but I'm not sure how much it affects us.

I would tend to lean towards keeping the number of dependencies to a minimum and migrate if and when we hit a serious bottleneck with Jest (I'm not best placed to determine whether we have or not).

@NSeydoux
Copy link
Contributor Author

Migrating the end-to-end tests to AVA should work, but it is low-priority. Closing this for now, but keeping it around.

@NSeydoux NSeydoux closed this Jan 21, 2022
@NSeydoux NSeydoux deleted the exp/ava branch May 17, 2022 08:58
@NSeydoux NSeydoux restored the exp/ava branch May 17, 2022 08:58
@jeswr jeswr deleted the exp/ava branch June 20, 2023 04:14
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