Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Aug 20, 2025

Add Vitest test command and run unit tests

Summary

This PR adds a proper test runner setup using Vitest for the PVM Debugger project. Previously, the project had unit tests in src/packages/pvm/jam-codec/ but no npm script to run them.

Changes:

  • Added Vitest as dev dependency in package.json
  • Added npm run test and npm run test:watch scripts
  • Created vitest.config.ts to run unit tests under src/ while excluding Playwright E2E tests in tests/
  • Migrated 2 existing unit test files from node:test imports to vitest imports
  • Updated package-lock.json with new dependencies

The unit tests now run via npm run test and all 31 tests pass (2 test files covering JAM codec functionality).

Review & Testing Checklist for Human

  • Run npm run test locally - Verify it executes and all tests pass (should show 2 files, 31 tests)
  • Check test migration correctness - Compare test behavior before/after by reviewing the migrated test files for any unintended changes beyond import statements
  • Verify Playwright E2E tests still work - Run existing E2E test commands to ensure vitest config exclusion doesn't interfere
  • Test the test:watch script - Run npm run test:watch to ensure watch mode works correctly

Recommended test plan:

  1. Clean install: rm -rf node_modules package-lock.json && npm install
  2. Run unit tests: npm run test (expect 31 passing tests)
  3. Run lint: npm run lint (should pass)
  4. Verify E2E tests independently (if you have commands for those)

Diagram

%%{ init : { "theme" : "default" }}%%
flowchart TD
    PJ["package.json<br/>Scripts + Dependencies"]:::major-edit
    VC["vitest.config.ts<br/>Test Configuration"]:::major-edit
    T1["src/packages/pvm/jam-codec/<br/>little-endian-decoder.test.ts"]:::minor-edit
    T2["src/packages/pvm/jam-codec/<br/>decode-natural-number.test.ts"]:::minor-edit
    E2E["tests/<br/>Playwright E2E Tests"]:::context
    
    PJ -->|"defines test scripts"| VC
    VC -->|"includes"| T1
    VC -->|"includes"| T2
    VC -->|"excludes"| E2E
    
    subgraph Legend
        L1[Major Edit]:::major-edit
        L2[Minor Edit]:::minor-edit
        L3[Context/No Edit]:::context
    end
    
    classDef major-edit fill:#90EE90
    classDef minor-edit fill:#87CEEB  
    classDef context fill:#FFFFFF
Loading

Notes

Link to Devin run: https://app.devin.ai/sessions/32696a16f4d549ffbd30d1b02a60040c

Requested by: Tomek (@tomusdrw)

The migration from node:test to vitest was minimal - only import statements changed, not test logic. However, different test runners can have subtle behavioral differences, so human verification is recommended. The vitest config intentionally separates unit tests (src/) from E2E tests (tests/) to avoid conflicts.

devin-ai-integration bot and others added 2 commits August 20, 2025 08:24
Co-Authored-By: Tomek Drwięga <tomusdrw+github@gmail.com>
Co-Authored-By: Tomek Drwięga <tomusdrw+github@gmail.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@netlify
Copy link

netlify bot commented Aug 20, 2025

Deploy Preview for pvm-debugger ready!

Name Link
🔨 Latest commit 5e6af4b
🔍 Latest deploy log https://app.netlify.com/projects/pvm-debugger/deploys/68a5908342bd1900085d4a0a
😎 Deploy Preview https://deploy-preview-380--pvm-debugger.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@tomusdrw tomusdrw merged commit ea032fe into main Aug 20, 2025
6 checks passed
@tomusdrw tomusdrw deleted the devin/1755678270-add-vitest-unit-tests branch August 20, 2025 09:31
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