Skip to content

Comments

fix(vitest): handle single await vi.hoisted#4962

Merged
sheremet-va merged 2 commits intovitest-dev:mainfrom
hi-ogawa:fix-handle-single-await-hoisted
Jan 15, 2024
Merged

fix(vitest): handle single await vi.hoisted#4962
sheremet-va merged 2 commits intovitest-dev:mainfrom
hi-ogawa:fix-handle-single-await-hoisted

Conversation

@hi-ogawa
Copy link
Contributor

@hi-ogawa hi-ogawa commented Jan 15, 2024

Description

I loosened regex to match (vi|vitest).(mock|unmock|hoisted) anywhere in the code (not necessary assignment nor beginning of line).

Btw, it looks like currently tests are failing locally when color is enabled probably because of code frame offset not taking account highlight:

frame: generateCodeFrame(highlight(code), 4, insideCall.start + 1),

So, for now I verified it by running with NO_COLOR=1.
(I tried to reproduced it but it doesn't look like highlight is enabled in user's tests https://stackblitz.com/edit/vitest-dev-vitest-nanulr?file=test%2Frepro.test.ts)

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

@netlify
Copy link

netlify bot commented Jan 15, 2024

Deploy Preview for fastidious-cascaron-4ded94 canceled.

Name Link
🔨 Latest commit c3de3ef
🔍 Latest deploy log https://app.netlify.com/sites/fastidious-cascaron-4ded94/deploys/65a506ce2ddaa3000875814a

@hi-ogawa hi-ogawa marked this pull request as ready for review January 15, 2024 03:34
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.

await vi.hoisted not hoisted when used alone

2 participants