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

refactor: replace ava with vitest and esm #5836

Closed

Conversation

hereje
Copy link
Contributor

@hereje hereje commented Jul 4, 2023

🎉 Thanks for submitting a pull request! 🎉

Summary

Convert all test files from commonjs to ESM

Fixes #5698

  • Convert test files from commonjs to ESM
  • Replace ava with vitest on each file and adjust expectations/assertions accordingly
  • Lint files
  • Remove the following ava test scripts: test:dev:ava, test:ci:ava:integration from package.json because they are no longer needed.
  • Remove ava configuration from package.json

Pending activities:

  • Remove ava from dependencies
  • Adjust watch script on package.json
  • Adjust lint rule 'ava/no-import-test-files': 'off',on .eslintrc.cjs
  • Review if the following snippet is needed in test files:
const avaTest = require('ava') // no longer used but as reference
const { isCI } = require('ci-info')  // no longer used but as reference

const test = isCI ? avaTest.serial.bind(avaTest) : avaTest // TODO: Is there anything to do with serial tests on vitest?

test('a test case', async (t) => {
const response = 'DEFAULT_CONTEXT'
 t.is(response, 'DEFAULT_CONTEXT')
})

For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

Sorry, something went wrong.

@hereje hereje requested a review from a team as a code owner July 4, 2023 20:49
@hereje hereje changed the title Refactor/replace ava with vitest and esm refactor: replace ava with vitest and esm Jul 4, 2023
@github-actions
Copy link

📊 Benchmark results

Comparing with 47142bd

  • Dependency count: 1,299 (no change)
  • Package size: 270 MB ⬇️ 0.02% decrease vs. 47142bd

@lukasholzer
Copy link
Collaborator

Hey @hereje thanks for taking this big effort for us!
That is awesome work! 🥇
Can you maybe split this out into multiple smaller PR's? Like, migrate each test by test file?

By that, we can simpler review it and you can avoid merge conflicts easier.

Copy link
Collaborator

@lukasholzer lukasholzer left a comment

Choose a reason for hiding this comment

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

And maybe move the files in the location of the specific commands.

Like tests/integration/100.command.dev.test.cjs -> tests/integration/commands/dev/dev.test.mjs`


const test = isCI ? avaTest.serial.bind(avaTest) : avaTest
// FIXME: Run tests serial
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we remove that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course. I'll do it!

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.

Refactor all tests to use ESM and vitest
2 participants