-
Notifications
You must be signed in to change notification settings - Fork 938
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: migrate from nodeunit to jest #640
Open
cesine
wants to merge
35
commits into
shutterstock:main
Choose a base branch
from
cesine:coverage
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Replace nodeunit with Jest in package.json - Add Jest configuration optimized for browser/D3 testing - Update test scripts to use Jest - Add Jest setup file for global configuration
- Add Rickshaw.Graph.Legend.test.js with self-contained tests and helper function - Add Rickshaw.Graph.Renderer.Scatterplot.test.js with D3 v3 compatibility - Remove global state and beforeEach/afterEach hooks - Add proper DOM cleanup in each test - Improve test readability with clear setup/assertion/cleanup sections
- Add comprehensive render tests - Add DOM cleanup tests - Fix callback assertions - Match and exceed original test coverage
- Update collectCoverageFrom to target root directory source files - Exclude bundle files from coverage
- Remove manual JSDOM setup in favor of Jest's built-in JSDOM environment - Simplify DOM setup using document.body.innerHTML - Remove manual cleanup of global document/window - Maintain original test coverage and functionality
- Convert nodeunit test to Jest format - Use createElement for DOM setup - Maintain original test coverage and functionality
- Convert nodeunit test to Jest format - Add proper DOM setup and cleanup - Handle annotation data structure and events correctly - Maintain original test coverage and functionality
- Convert nodeunit test to Jest format - Organize tests into logical groups - Add descriptive test names - Add test for mid-year values - Maintain original test coverage
- Convert nodeunit test to Jest format - Organize tests into logical groups - Add descriptive test names - Add explicit timezone verification test - Maintain original test coverage
- Convert nodeunit test to Jest format - Use document.body.innerHTML for DOM setup - Add proper jQuery initialization - Maintain original test coverage and functionality - Keep DOM setup local to each test
- Convert nodeunit test to Jest format - Keep jQuery global as required by source
- Convert nodeunit test to Jest format - Use direct element creation without IDs - Add proper DOM cleanup - Maintain original test coverage and functionality
- Convert nodeunit test to Jest format - Minimize shared state by moving setup into test - Add proper DOM and renderer cleanup - Maintain original test coverage
- Convert nodeunit test to Jest format - Add proper Array inheritance checks - Add descriptive comments about data point interpolation - Maintain original test coverage
- Convert nodeunit tests to Jest format - Minimize shared state by moving element creation into individual tests - Remove shared series data from test scopes - Add descriptive test blocks and assertions - Maintain original test coverage and functionality
- Added comprehensive test coverage for Color Palette - Removed d3 mocking in favor of integration testing - Added tests for edge cases and core functionality
- Added comprehensive test coverage for RangeSlider.Preview - Created helper functions for clean test instance creation - Ensured test isolation with no shared state - Added tests for error handling, callbacks, and DOM structure
Migrated Rickshaw.Graph.Renderer tests from nodeunit to Jest: - Added comprehensive domain calculation tests - Added stroke factory tests - Added empty series handling tests - Added configuration tests - Created reusable test helper functions - Maintained original test behavior with TODO note
Migrated main Rickshaw test file from nodeunit to Jest: - Added version check test - Added namespace existence tests - Added color utilities tests - Added class system tests - Improved test organization and coverage
- Reduce shared state in test by moving test data into individual test cases - Fix fill method test to properly verify null fill value - Remove debug logging
add coverage for ajax Update coverage thresholds to match current test coverage:
- Fix legend item order handling - Improve transform function verification - Fix stroke color comparison - Add comprehensive test cases for series highlighting
Added comprehensive test coverage for the Series Order behavior: - Test jQuery and jQuery UI dependency checks - Verify legend sortable initialization - Test graph updates on legend reordering - Verify legend height maintenance Implemented with minimal jQuery UI mock to avoid external dependencies.
Added comprehensive test coverage for the LinePlot renderer: - Test default settings and configuration - Verify path and circle rendering - Test custom dot sizes (global and per-point) - Handle disabled series and null values - Test line interpolation and tension Improved test isolation using: - Helper function for graph creation - Clean DOM cleanup - Proper d3 line factory mocking
cesine
commented
Nov 27, 2024
@@ -14,7 +14,7 @@ jobs: | |||
|
|||
strategy: | |||
matrix: | |||
node-version: [12.x, 22.x] | |||
node-version: [22.x] |
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.
jest no longer supports node 12 https://jestjs.io/docs/upgrading-to-jest29
https://github.com/cesine/rickshaw/actions/runs/12040292801/job/33569879332
Run npm run coverage
> [email protected] coverage /home/runner/work/rickshaw/rickshaw
> jest --coverage
/home/runner/work/rickshaw/rickshaw/node_modules/jest/node_modules/jest-cli/build/run.js:135
if (error?.stack) {
^
SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/loader.js:[9](https://github.com/cesine/rickshaw/actions/runs/12040317722/job/33569956048#step:6:10)15:16)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
nodeunit is deprecated. we considered mocha and jest and went with jest since it has good support for dom testing.
How this was tested
Review without whitespace to see what is actually changed https://github.com/shutterstock/rickshaw/pull/640/files?diff=split&w=1