Commit 4d2acaa
authored
refactor: migrate to node:test and setup jsdom environment (#5667)
* feat(tests): add node test setup and update test utilities
- Introduced a new script for node test setup (`scripts/node-test-setup.mjs`) to configure snapshot serializers and resolve snapshot paths for webpack tests.
- Added new npm script `test:node` in `package.json` for running node tests with specific configurations.
- Updated Jest snapshots in `proxy-option.test.js.snap.webpack5` to reflect changes in test descriptions.
- Refactored tests in `open-option.test.js` and `proxy-option.test.js` to utilize `jest-mock` for mocking and spying, replacing previous Jest mocking methods.
- Changed `beforeAll` and `afterAll` hooks to `before` and `after` for better test isolation and readability.
* refactor(tests): update snapshot test descriptions and improve test structure
- Changed snapshot test descriptions to include a more structured format.
- Updated snapshot assertions to use `t.assert.snapshot` for consistency.
- Refactored test setup and teardown methods to use `before` and `after` from `node:test`.
- Adjusted the test cases in `normalize-options.test.js` and `validate-options.test.js` for improved clarity and maintainability.
* refactor(tests): update CLI option tests to use node:test and expect
- Refactored multiple test files to utilize the `node:test` module for structuring tests.
- Replaced direct assertions with `t.assert.snapshot` for snapshot testing.
- Ensured consistency across tests by adding async context to test functions.
- Updated imports to include necessary testing utilities from `node:test` and `expect`.
* refactor(tests): update web socket tests to use node:test and expect assertions
- Replaced traditional test structure with node:test for better test organization.
- Updated snapshot assertions to use the new test framework's syntax.
- Ensured all test cases in web-socket-communication.test.js, web-socket-server-url.test.js, and web-socket-server.test.js are consistent with the new structure.
* refactor(tests): migrate tests to use node:test and improve snapshot organization
- Updated test files to utilize the `node:test` module for better compatibility and performance.
- Replaced `jest.fn()` with `jest-mock` functions for mocking in various test cases.
- Enhanced snapshot descriptions for clarity and consistency across tests.
- Introduced a new `jsdom-setup.js` helper to streamline JSDOM configuration for tests.
- Adjusted test cases to use `t.assert.snapshot()` for snapshot assertions.
- Cleaned up mock implementations and reset logic in tests for improved reliability.
* refactor: migrate tests from Jest to Node's test module
- Updated package.json to remove Jest dependencies and adjust test scripts for Node's test module.
- Deleted globalSetupTest.js and setupTest.js as they are no longer needed.
- Refactored ReactErrorBoundary.test.js to utilize real jsdom window/document.
- Updated WebsocketClient.test.js to use async/await and improved test structure.
- Skipped index.test.js due to dependency on Jest's mocking capabilities.
- Refactored socket-helper.test.js to create a mock WebSocketClient class.
- Updated log.test.js to simplify logger tests and remove unnecessary mocks.
- Enhanced jsdom-setup.js to replace jsdom's WebSocket with Node's ws library for better testing of WebSocket connections.
* fixup!
* fixup!
* fixup!
* fixup!
* fixup!
* fixup!
* fixup!
* fixup!
* fixup!
* fixup!
* fixup!
* chore: update test runner
* fixup!
* chore: update snapshots and fix module path in API tests
* fixup!
* fixup!
* chore: update snapshots for watchFiles option tests
* refactor: remove unused Logger interface and simplify socket function parameters
* fix: update snapshot serialization for Windows compatibility and adjust test helper import
* fix: codecov upload
* fix: ensure directories are created for test reporter destination
* refactor: simplify client resolution and clean up socket tests
* refactor: clean up comments and improve clarity in test files
* fixup!1 parent a7ab30f commit 4d2acaa
133 files changed
Lines changed: 12270 additions & 14796 deletions
File tree
- .github/workflows
- lib
- scripts
- test
- __snapshots__
- client
- __snapshots__
- clients
- __snapshots__
- utils
- __snapshots__
- cli
- __snapshots__
- e2e
- __snapshots__
- helpers
- server
- __snapshots__
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
24 | 42 | | |
25 | 43 | | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3392 | 3392 | | |
3393 | 3393 | | |
3394 | 3394 | | |
| 3395 | + | |
| 3396 | + | |
| 3397 | + | |
| 3398 | + | |
| 3399 | + | |
| 3400 | + | |
| 3401 | + | |
| 3402 | + | |
| 3403 | + | |
| 3404 | + | |
| 3405 | + | |
3395 | 3406 | | |
3396 | 3407 | | |
3397 | 3408 | | |
| |||
0 commit comments