-
Notifications
You must be signed in to change notification settings - Fork 3.4k
misc: convert webpack-preprocessor tests to vitest #32895
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
Conversation
17ae6aa to
c13e66c
Compare
c13e66c to
3e073ee
Compare
a3472ff to
1ebe107
Compare
cypress
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Project |
cypress
|
| Branch Review |
chore/webpack-preprocessor-vitest
|
| Run status |
|
| Run duration | 17m 11s |
| Commit |
|
| Committer | Bill Glesias |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
1
|
|
|
2
|
|
|
132
|
|
|
0
|
|
|
6245
|
| View all changes introduced in this branch ↗︎ | |
UI Coverage
38.03%
|
|
|---|---|
|
|
132
|
|
|
81
|
Accessibility
97.39%
|
|
|---|---|
|
|
3 critical
7 serious
1 moderate
1 minor
|
|
|
62
|
Tests for review
cypress/e2e/commands/files.cy.js • 1 failed test • 5x-driver-firefox
| Test | Artifacts | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| src/cy/commands/files > #readFile > retries to read when ENOENT |
| |||||||||||||
| Test | Artifacts | |||||||
|---|---|---|---|---|---|---|---|---|
| ... > stops waiting when an xhr request is canceled |
| |||||||
| Test | Artifacts | |
|---|---|---|
| issue 28527 > fails and then retries and verifies about:blank is not displayed |
Screenshots
|
|
498b424 to
a0c2cb2
Compare
5404723 to
9665122
Compare
| logs.push(str) | ||
| if (passThrough) { | ||
| return write.apply(this, [passThrough(str)]) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: WriteStream.write: missing return value breaks backpressure
The stdio.write override doesn't return a value when passThrough is falsy, but Node.js WriteStream.write() must return a boolean indicating whether the write was successful. This can cause issues with backpressure handling and may break code that checks the return value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't relevant
Additional details
Converts the tests in
@cypress/webpack-preprocessorfrommochatovitest. Because this is still a CommonJS module that relies onrequire()to source the TypeScript location for the consuming user, I needed to introducemock-requireand refactored this code intoget-typescriptto test this functionality separately.proxyquireisn't an option here as I cannot get it to run in the vitest context (see vitest-dev/vitest#3134). This is only temporary until we move to ESM in this module or replace it.I also merged the
helpersfile into thee2e.spec.tsas its the only file that is using this.Steps to test
How has the user experience changed?
PR Tasks
cypress-documentation?type definitions?Note
Migrates @cypress/webpack-preprocessor tests from Mocha to Vitest, adds a
get-typescripthelper and refactors TS overrides, updates configs/scripts and minor types/ESM tweaks.test/unit/*.spec.ts,test/e2e/*.spec.ts), replace Chai/Sinon/SnapShot with Vitest APIs and snapshots; remove legacy Mocha tests/helpers.vitest.config.tsand update snapshots (__snapshots__/compilation.spec.ts.snap).lib/get-typescript.tsand use it inlib/typescript-overrides.tsfor resolving the project TypeScript; update tests for it.WebpackPreprocessorFnoptions optional; keep CJS export with note for future ESM.package.jsonscripts to run Vitest; switch test runner script to TS (scripts/test-webpack-5.ts) andtsxexecution; remove Mocha/Chai/Sinon deps; addvitest,strip-ansi,mock-require, TS v5.cypress.config.tsto ESM import/export and simplify preprocessor wiring.guides/esm-migration.mdchecklist to marknpm/webpack-preprocessoras completed in Phase 2.Written by Cursor Bugbot for commit 9665122. This will update automatically on new commits. Configure here.