Skip to content

feat : Convert check scripts to Vitest in place - #133

Open
dawgdevv wants to merge 8 commits into
Autoloops:mainfrom
dawgdevv:test/migrate-checks-to-vitest
Open

feat : Convert check scripts to Vitest in place#133
dawgdevv wants to merge 8 commits into
Autoloops:mainfrom
dawgdevv:test/migrate-checks-to-vitest

Conversation

@dawgdevv

Copy link
Copy Markdown

Convert check scripts to Vitest in place

Summary

Converts all 7 scripts/check-*.js check scripts from plain node:assert
scripts to Vitest test suites in place same files, same directory,
same filenames. This gives the reviewer a clean line-by-line diff showing
each assert.* call being replaced by its expect() equivalent.

Why in place?

The previous approach (delete old scripts + add new tests/integration/*.test.ts
files) made the PR unreviewable —

What changed

Each scripts/check-*.js file was mechanically converted:

Change From To
Test structure Flat top-to-bottom script describe() / test() blocks
Assertions assert.equal(a, b) expect(a).toBe(b)
assert.deepEqual(a, b) expect(a).toEqual(b)
assert.match(a, /re/) expect(a).toMatch(/re/)
assert.doesNotMatch(a, /re/) expect(a).not.toMatch(/re/)
assert.ok(a) expect(a).toBe(true)
assert.notEqual(a, b) expect(a).not.toBe(b)
assert.throws(fn, /re/) expect(fn).toThrow(/re/)
assert.doesNotThrow(fn) expect(fn).not.toThrow()
Imports Top-level await import() beforeAll(async () => ...)
Temp dirs Single shared mkdtempSync Per-test mkdtempSync (better isolation)
Console console.log("...: ok") Removed (Vitest reports pass/fail)

No test logic was changed. Every assertion, input data, regex pattern,
and expected value is identical to the previous implementation.

Files modified (7 scripts)

Script Tests What it covers
check-transcript-bundle.js 5 Codex/Claude/Copilot/OpenCode bundling, system instruction stripping, missing file error
check-repo-context.js 5 Non-git fallback, SSH/HTTPS remote parsing, default branch detection
check-install-options.js 8 Auto-save, guidance-only, no-hooks, opencode, copilot, flag validation, uninstalled repo error
check-graph-view.js 1 Rendering components without code anchors
check-proposal-validate.js 4 Malformed edges, missing kind, compact edges, repo-scoped graph objects
check-bm25-tokenizer.js 7 camelCase/PascalCase/snake_case/kebab-case tokenization, stemming, BM25 scoring
check-anchor-drift.js 5 Unchanged code, value change, comment-only, whitespace-only, no baseline

Infrastructure changes

  • vitest.config.ts — new, targets scripts/check-*.js, excludes check-node-version.js
  • package.jsontest now runs npm run build && vitest run; added test:fast, test:watch, test:coverage
  • package.json — added vitest and @vitest/coverage-v8 to devDependencies

Pre-existing build fix

While merging origin/main, discovered a pre-existing build breakage: libs/install/platforms/opencode.ts imported HookInput from ../../hooks/hook-input.js but commit #95 moved HookInput to ../../hooks/types.ts without re-exporting. Fixed the import to match the pattern used in openhands.ts:

// before (broken on main)
import { hookSessionId, type HookInput } from "../../hooks/hook-input.js";

// after
import { hookSessionId } from "../../hooks/hook-input.js";
import type { HookInput } from "../../hooks/types.js";

Verification

Test Files 7 passed (7)
Tests 35 passed (35)
Duration 3.16s

  • npm test — build + full suite (CI default)
  • npm run test:fast — skip rebuild, run tests only
  • npm run test:watch — watch mode for development
  • npm run test:coverage — coverage report

dawgdevv added 8 commits July 6, 2026 14:17
- Updated `package.json` to replace existing test scripts with Vitest commands.
- Added `vitest.config.ts` for Vitest configuration.
- Excluded `tests` and `node_modules` from build in `tsconfig.build.json`.
- Included `tests/**/*.ts` in `tsconfig.json` for TypeScript compilation.
- Removed outdated test scripts: `check-graph-view.js`, `check-install-options.js`, `check-proposal-validate.js`, `check-repo-context.js`, and `check-transcript-bundle.js`.
- Introduced new integration tests for graph view, install options, proposal validation, repo context detection, and transcript bundling.
Brings back updated check scripts from main (Autoloops#100, Autoloops#105, Autoloops#107, Autoloops#102)
alongside new Vitest tests so changes can be ported and verified.
…tests

- Removed deprecated check scripts for BM25 tokenizer, install options, proposal validation, and transcript bundling.
- Updated OpenCode module to import HookInput from types instead of hooks.
- Enhanced install options tests to verify OpenCode's support for hooks and auto memory updates.
- Improved transcript bundling tests for OpenCode to ensure proper handling of system instructions.
…all options, proposal validation, repo context, and transcript bundling

- Introduced new test scripts to validate BM25 tokenization for various naming conventions.
- Added checks for graph view rendering and component initialization.
- Implemented tests for install options, ensuring correct behavior for hooks and auto memory updates.
- Validated proposal normalization and edge cases in proposal validation.
- Established repo context detection tests for different repository setups.
- Created transcript bundling tests for multiple platforms, ensuring proper handling of session data and instructions.
Copilot AI review requested due to automatic review settings July 10, 2026 18:20

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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