Skip to content

test: collect coverage - #2

Merged
ddeboer merged 1 commit into
mainfrom
test-coverage
Jun 21, 2025
Merged

ddeboer merged 1 commit into
mainfrom
test-coverage

Conversation

@ddeboer

@ddeboer ddeboer commented Jun 21, 2025

Copy link
Copy Markdown
Member
  • Use Vitest instead of Jest because it has coverage threshold bumping built-in.

* Use Vitest instead of Jest because it has coverage threshold bumping
  built-in.
@ddeboer
ddeboer requested a review from Copilot June 21, 2025 19:57
@nx-cloud

nx-cloud Bot commented Jun 21, 2025 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 962de8f.

Command Status Duration Result
nx affected -t lint test build ❌ Failed 44s View ↗

☁️ Nx Cloud last updated this comment at 2025-06-21 19:57:46 UTC

@ddeboer
ddeboer merged commit 587f157 into main Jun 21, 2025

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR replaces Jest with Vitest to use its built-in coverage threshold bumping and updates project configs and dependencies accordingly.

  • Introduces a base Vitest configuration and merges it into the client package
  • Removes legacy Jest config and updates dependencies to include Vitest and related plugins
  • Registers the Nx Vite plugin and adjusts ESLint to ignore generated Vite/Vitest files

Reviewed Changes

Copilot reviewed 7 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
vite.base.config.ts Add global Vitest test configuration
packages/dataset-registry-client/vite.config.ts Merge base config and set project-specific thresholds
packages/dataset-registry-client/jest.config.ts Remove legacy Jest configuration
package.json Bump Nx plugins, add Vitest deps & scripts
nx.json Register @nx/vite/plugin
jest.preset.js Enable coverage collection in Jest preset
eslint.config.mjs Ignore Vite/Vitest timestamp files & extend allow patterns
Comments suppressed due to low confidence (2)

jest.preset.js:6

  • [nitpick] Since testing is migrating from Jest to Vitest, review whether this Jest preset block is still needed or can be removed to eliminate unused legacy configuration.
  collectCoverage: true,

package.json:31

  • Jest-related dependencies remain despite switching to Vitest. If Jest is no longer used downstream, consider removing these to streamline your dependency footprint.
    "jest": "^29.7.0",

@@ -0,0 +1,21 @@
/// <reference types='vitest' />
import { defineConfig, mergeConfig } from 'vite';
import baseConfig from '../../vite.base.config.js';

Copilot AI Jun 21, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] Because the source file is TypeScript (.ts), importing it as .js may confuse readers. Consider either importing the .ts path or adding a comment explaining runtime transpilation via jiti so intent is clear.

Suggested change
import baseConfig from '../../vite.base.config.js';
import baseConfig from '../../vite.base.config.ts';

Copilot uses AI. Check for mistakes.
Comment thread package.json
"eslint-config-prettier": "^10.0.0",
"husky": "^9.1.7",
"jest": "^29.7.0",
"jest-coverage-thresholds-bumper": "^1.1.0",

Copilot AI Jun 21, 2025

Copy link

Choose a reason for hiding this comment

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

The bump-coverage-thresholds target currently runs cat package.json, which does not invoke the coverage-bumper tool. Update the command to use the CLI (e.g., jest-coverage-thresholds-bumper bump) to actually bump thresholds.

Copilot uses AI. Check for mistakes.
Comment thread eslint.config.mjs
allow: ['^.*/eslint(\\.base)?\\.config\\.[cm]?js$'],
allow: [
'^.*/eslint(\\.base)?\\.config\\.[cm]?js$',
'^.*/vite(\\.base)?\\.config\\.?js',

Copilot AI Jun 21, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] This regex only matches .js config files. To avoid lint errors on TypeScript-based configs (e.g., .ts), consider extending it to match both .js and .ts variants (e.g., \.config\.[cm]?[jt]s).

Suggested change
'^.*/vite(\\.base)?\\.config\\.?js',
'^.*/vite(\\.base)?\\.config\\.[cm]?[jt]s$',

Copilot uses AI. Check for mistakes.
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.

2 participants