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] vitest migration issues #28356

Open
jeremymeng opened this issue Jan 24, 2024 · 5 comments
Open

[Test] vitest migration issues #28356

jeremymeng opened this issue Jan 24, 2024 · 5 comments
Labels
Client This issue points to a problem in the data-plane of the library. test-utils Label for the issues related to the @azure/test-utils package

Comments

@jeremymeng
Copy link
Contributor

jeremymeng commented Jan 24, 2024

This issue documents obstacles in migrating to vitest in our repo.

../../node_modules/@types/chai/index.d.ts:1:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: Message, ObjectProperty, ChaiPlugin, AssertionArgs, Operator, OperatorComparable, AssertionError, chai
  • vitest has cobertura report but our config doesn't enable it. We should replace the json reporter with cobertura, and add --coverage command line option to run test with code coverage

Node

Browser

  • We use an envProcessor plugin in Karma tests to inject environment variables to browser tests
  • module mocking in browser not implemented yet Implement module mocking in browser mode vitest-dev/vitest#3046
  • util dependency causes problem in tests.
  • we had to use verbatimModuleSyntax: true and add type to imports. However, it is not clear yet how we could make the export * from "./models" pattern work. We use this pattern a lot in codegen.
SyntaxError: The requested module '/src/generated/src/index.ts' does not provide an export named 'ConfigurationSnapshot'
@jeremymeng jeremymeng added Client This issue points to a problem in the data-plane of the library. test-utils Label for the issues related to the @azure/test-utils package labels Jan 24, 2024
@github-actions github-actions bot added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jan 24, 2024
@xirzec
Copy link
Member

xirzec commented Jan 24, 2024

the main tsc problem seems to be chai globals conflicting with the bundled version of chai that vitest provides

@xirzec
Copy link
Member

xirzec commented Jan 24, 2024

for environment variables I think we can use vite config for this: https://vitejs.dev/config/#using-environment-variables-in-config

@xirzec xirzec removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jan 24, 2024
@xirzec
Copy link
Member

xirzec commented Jan 24, 2024

/cc @mpodwysocki

@jeremymeng
Copy link
Contributor Author

for environment variables I think we can use vite config for this: https://vitejs.dev/config/#using-environment-variables-in-config

yes, looking into that

@jeremymeng jeremymeng changed the title [Test] vitest migration blockers [Test] vitest migration issues Jan 25, 2024
@jeremymeng
Copy link
Contributor Author

/cc @maorleger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. test-utils Label for the issues related to the @azure/test-utils package
Projects
None yet
Development

No branches or pull requests

2 participants