Skip to content

refactor: migrate from mocha, chai, sinon to vitest#16370

Merged
kamilmysliwiec merged 18 commits intobuild/esm-migrationfrom
test/vitest-migration
Feb 15, 2026
Merged

refactor: migrate from mocha, chai, sinon to vitest#16370
kamilmysliwiec merged 18 commits intobuild/esm-migrationfrom
test/vitest-migration

Conversation

@kamilmysliwiec
Copy link
Copy Markdown
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

  • drop chai, mocha, sinon, and just use vitest instead (with swc to support TS decorators)
  • add more unit and integration tests

TODO: some integration tests are currently excluded, waiting for other Nest packages to get migrated to ESM

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@kamilmysliwiec kamilmysliwiec marked this pull request as ready for review February 15, 2026 15:43
@kamilmysliwiec kamilmysliwiec merged commit 945ca48 into build/esm-migration Feb 15, 2026
1 check passed
Comment on lines +23 to +37
swc.vite({
module: { type: 'es6' },
jsc: {
target: 'es2022',
parser: {
syntax: 'typescript',
decorators: true,
},
transform: {
legacyDecorator: true,
decoratorMetadata: true,
},
keepClassNames: true,
},
}),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just a heads up, the next version of Vitest (currently still in beta vitest@4.1.0-beta.4) uses Vite 8 under the hood, which uses oxc to transform. It has a built-in legacy decorator transform and also supports emitting decorator metadata, so that no SWC is needed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

thanks @Dunqing

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.

2 participants