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

Use vitest instead of react-scripts for tests #621

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

edlerd
Copy link
Collaborator

@edlerd edlerd commented Jan 22, 2024

Done

  • remove react-scripts
  • add vitest
  • change script runner

QA

  1. Run the LXD-UI:
    • On the demo server via the link posted by @webteam-app below. This is only available for PRs created by collaborators of the repo. Ask @lorumic or @edlerd for access.
    • With a local copy of this branch, run as described here.
  2. Perform the following QA steps:
    • ensure ci is executing ts spec tests and succeeding

@webteam-app
Copy link

Demo starting at https://lxd-ui-621.demos.haus

vitest.config.ts Outdated
@@ -0,0 +1,7 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we set the globals config so that we don't have to import test functions everywhere similar to jest?

// vitest.config.ts
import { defineConfig } from 'vitest/config'

export default defineConfig({
  test: {
    globals: true,
  },
})

If we set this, then we just need to add this to tsconfig.json as well:

// tsconfig.json
{
  "compilerOptions": {
    "types": ["vitest/globals"]
  }
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good idea, will change it :)

@mas-who
Copy link
Collaborator

mas-who commented Jan 23, 2024

LGTM. Just wondering if we should make vitest API imports global? Feel free to leave it as is.

Signed-off-by: David Edler <david.edler@canonical.com>
@edlerd edlerd merged commit f8bbe8e into canonical:main Jan 23, 2024
6 checks passed
@edlerd edlerd deleted the use-vitest branch January 23, 2024 09:31
github-actions bot pushed a commit that referenced this pull request Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants