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

chore: Use vitest for testing #71

Merged
merged 1 commit into from Mar 13, 2024
Merged

chore: Use vitest for testing #71

merged 1 commit into from Mar 13, 2024

Conversation

just-boris
Copy link
Member

@just-boris just-boris commented Mar 12, 2024

Improve dev experience, because we cannot build this package on Mac sass/dart-sass#1692

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

codecov bot commented Mar 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.60%. Comparing base (86c4ad7) to head (d79e291).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #71      +/-   ##
==========================================
- Coverage   97.04%   95.60%   -1.45%     
==========================================
  Files          43       47       +4     
  Lines        1015     2889    +1874     
  Branches      119      364     +245     
==========================================
+ Hits          985     2762    +1777     
- Misses         28      123      +95     
- Partials        2        4       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

function setupTest(
test: (process: (input: string) => Promise<string>) => Promise<void>
): (callback: () => void) => void {
return (callback: () => void) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

This test used test('...', done => {}) syntax, which is not supported by vitest, had to rewrite

@just-boris
Copy link
Member Author

Codecov complains about no test coverage in vitest configuration files. All expected, ignoring this

@just-boris just-boris marked this pull request as ready for review March 12, 2024 16:19
@just-boris just-boris requested a review from a team as a code owner March 12, 2024 16:19
@just-boris just-boris requested review from jperals and removed request for a team March 12, 2024 16:19
vitest.build.mjs Outdated

export default defineConfig({
test: {
include: ['./src/build/**/*.test.ts'],
Copy link
Member

Choose a reason for hiding this comment

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

If I understand correctly, in the old configuration the tests in src/shared would be covered by both the browser configuration (jest.browser.config.js) and the build configuration (jest.build.config.js), wheras after thees changes, they will only be covered by the browser configuration (vitest.browser.mjs) and not by the build configuration (vitest.build.mjs), because of this include path. Is this intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not intentional, thanks for finding. Fixed now

@jperals
Copy link
Member

jperals commented Mar 13, 2024

Are Codecov reports expected to work once Vitest releases this fix, or are further changes required from our side?

@just-boris
Copy link
Member Author

No, this is unrelated. It complains about vitest config files coverage. See the comment above: #71 (comment)

Because this is first time setup only, I am going to simply skip this check

@jperals
Copy link
Member

jperals commented Mar 13, 2024

Oh I see. But would it be possible to exclude these files from coverage?

@just-boris
Copy link
Member Author

just-boris commented Mar 13, 2024

This is issue on Codecov end, not on our config. Fixing this is definitely not in the scope of this PR

I think I found a fix

jperals
jperals previously approved these changes Mar 13, 2024
@just-boris just-boris merged commit 89daeee into main Mar 13, 2024
29 checks passed
@just-boris just-boris deleted the vitest branch March 13, 2024 14: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.

None yet

2 participants