Skip to content

RFC: Migrate from tape to vitest#9966

Merged
chrisgervang merged 6 commits intomasterfrom
chr/tape-to-vitest
Mar 4, 2026
Merged

RFC: Migrate from tape to vitest#9966
chrisgervang merged 6 commits intomasterfrom
chr/tape-to-vitest

Conversation

@chrisgervang
Copy link
Copy Markdown
Collaborator

@chrisgervang chrisgervang commented Jan 27, 2026

Background

This RFC proposes modernizing deck.gl's test infrastructure by replacing tape (assertion framework) + ocular-test (runner) with vitest. The migration would consolidate tooling, improve developer experience, and maintain CLI compatibility.

I'd like to learn about features/workflows maintainers used that I can test against vitest. I primarily used CI tests, which includes node, browser, and render tests.

Change List

  • Add RFC document at dev-docs/RFCs/proposals/vitest-migration-rfc.md
  • Proposes phased migration of ~185 test files
  • Details assertion mapping from tape to vitest
  • Covers @deck.gl/test-utils updates needed

Note

Low Risk
Low risk because this PR only adds documentation (an RFC) and does not change runtime code, build outputs, or CI behavior.

Overview
Adds a new draft RFC (dev-docs/RFCs/proposals/vitest-migration-rfc.md) proposing a phased migration from tape + ocular-test to vitest, including a Vitest workspace setup (node smoke tests + headless/headed browser runs) and a new/updated yarn command matrix.

The RFC also outlines planned API changes for test files (tape assertions → expect()), a Playwright-based replacement for Puppeteer/BrowserTestDriver in browser/render/interaction tests, and a proposed @deck.gl/test-utils update to use an injectable createSpy with a deprecation timeline for the implicit probe.gl fallback.

Written by Cursor Bugbot for commit dc15d7c. This will update automatically on new commits. Configure here.

@coveralls
Copy link
Copy Markdown

coveralls commented Jan 27, 2026

Coverage Status

coverage: 91.006%. remained the same
when pulling dc15d7c on chr/tape-to-vitest
into 1ecaec5 on master.

Copy link
Copy Markdown
Collaborator

@felixpalmer felixpalmer left a comment

Choose a reason for hiding this comment

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

I'm in favour of this migration, not having an easy way to do TDD has long been a pain point.

My worry is that there will be a long tail of specific patterns that we have developed over the years to work with tape which will take time to port to vitest. On the other hand, this sort of migration seems the perfect task for an AI agent to tackle, so it's certainly worth trying.


## Open Questions

1. Should we convert test file structure to use `describe`/`it` blocks, or keep flat `test()` calls?
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This will already be a huge PR, I would keep the test() calls for now

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agreed. My approach is to vibe code a code mod and that would keep the structure the same, just convert syntax.

## Verification

1. `yarn test-node` - runs unit tests in Node (fast feedback)
2. `yarn test-browser` - runs ALL tests in Chromium (unit + render + interaction)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

When testing I use yarn test browser as I can be more confident that it'll match what CI does. My biggest irritation is how the render tests open a browser window and steals focus. My preference for a fast feedback loop would be to run in the browser, but skipping render tests. Generally I disable render tests for initial testing and then run them when I'm mostly done with a feature

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, that's annoying. Let's have the goal be to make the primary command headless and match between local and CI

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Proposal: going forward "yarn test-browser" will always open a browser with a vitest runner UI, and perform all tests including render tests.

To just run the test suite in a headless browser without any browser opening and stealing focus, it'll be yarn test-headless

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 5 potential issues.

Comment thread dev-docs/RFCs/proposals/vitest-migration-rfc.md Outdated
Comment thread dev-docs/RFCs/proposals/vitest-migration-rfc.md Outdated

**1.1 Install dependencies:**
```bash
yarn add -D @vitest/browser @vitest/browser-playwright playwright
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing core vitest package in installation dependencies

High Severity

Phase 1 installation command only adds browser-specific packages (@vitest/browser, @vitest/browser-playwright, playwright) but omits the core vitest package itself. Since this RFC proposes migrating FROM tape TO vitest, the core vitest package doesn't exist yet and must be included in the installation. Without it, none of the vitest commands in the RFC will work.

Fix in Cursor Fix in Web

Comment thread dev-docs/RFCs/proposals/vitest-migration-rfc.md Outdated
Comment thread dev-docs/RFCs/proposals/vitest-migration-rfc.md
@chrisgervang
Copy link
Copy Markdown
Collaborator Author

My worry is that there will be a long tail of specific patterns that we have developed over the years to work with tape which will take time to port to vitest. On the other hand, this sort of migration seems the perfect task for an AI agent to tackle, so it's certainly worth trying.

Ha, exactly! After a few false starts I pointed Conductor and Claude Code to make a idempotent conversion script that fed git show master:... in and output the ported test file. The trick seems to be giving the agent a safe way to iterate forward.. otherwise it gets stuck in a loop of breaking things and uses tonnnns of tokens

Comment on lines +249 to +251
**Decision point after discovery:**
- **Few failures (~10-20%)** → Keep hybrid, rename failures to `.browser.spec.ts`
- **Many failures (~50%+)** → Fall back to browser-only approach
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Trying to run all of the tests in the node environment resulted in a lot of failures (which is not a surprise), so I'm going to instead implement the same test config for node that we have on master - use node for a smoke-test, and browser for all tests.

Comment on lines +77 to +79
|---------|-------------|
| `*.spec.ts` | Default - runs in both environments |
| `*.browser.spec.ts` | Browser-only (WebGL, real DOM, etc.) |
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

There are so few node tests that I'm actually going to flip the pattern. Default runs in browser, *.node.spec.ts runs in both.

Comment thread dev-docs/RFCs/proposals/vitest-migration-rfc.md Outdated
## Verification

1. `yarn test-node` - runs unit tests in Node (fast feedback)
2. `yarn test-browser` - runs ALL tests in Chromium (unit + render + interaction)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Proposal: going forward "yarn test-browser" will always open a browser with a vitest runner UI, and perform all tests including render tests.

To just run the test suite in a headless browser without any browser opening and stealing focus, it'll be yarn test-headless

@felixpalmer
Copy link
Copy Markdown
Collaborator

Proposal: going forward "yarn test-browser" will always open a browser with a vitest runner UI, and perform all tests including render tests.

To just run the test suite in a headless browser without any browser opening and stealing focus, it'll be yarn test-headless
@chrisgervang will the render tests also work in headless mode?

@chrisgervang
Copy link
Copy Markdown
Collaborator Author

@felixpalmer yup, the headless environment run it all in playwright without stealing focus or opening a browser

@chrisgervang chrisgervang force-pushed the chr/tape-to-vitest branch 2 times, most recently from ed2dece to d2c9f78 Compare February 27, 2026 19:07
chrisgervang and others added 6 commits March 4, 2026 14:30
Proposes replacing tape (assertions) + ocular-test (runner) with vitest.
See dev-docs/RFCs/proposals/vitest-migration-rfc.md for full details.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add vitest workspace configuration (node/browser/headless projects)
- Clarify entry points: browser as source of truth, node as smoke test
- Add Playwright rationale (required by vitest browser mode)
- Expand Phase 4 with discovery mechanism for browser-only tests
- Add detailed Phase 5 for snapshot/interaction test migration
- Add Verification section with test commands
- Update risks table with new considerations

Co-Authored-By: Claude <noreply@anthropic.com>
- Add 3-phase deprecation plan (9.3.x → 9.4.x → 10.0.0)
- Include migration guide for external consumers
- Resolve open question #3 about tape deprecation timeline

Co-Authored-By: Claude <noreply@anthropic.com>
- Flip file naming: *.node.spec.ts (node) vs *.spec.ts (browser)
- Change to vitest.workspace.ts with defineWorkspace
- Add CLI command mapping and matrix tables
- Document Phase 4 outcome: ~95% tests need browser
- List node smoke tests (2 files) and excluded tests

Co-Authored-By: Claude <noreply@anthropic.com>
- Add injectable spy API for framework-agnostic test-utils
- Document backward compatibility with lazy probe.gl fallback
- Add Phase 5 outcome: browser commands, test runners migrated
- Document interaction tests passing, render tests need work
- Add Phase 7: future benchmark and size test migration
- Update Phase 6 cleanup with specific .ocularrc.js items

Co-Authored-By: Claude <noreply@anthropic.com>
- @probe.gl/test-utils is now required (static import in tape.ts)
- vitest ^4.0.18 added as optional peer dependency
- Note: vitest-only users don't need probe.gl but it's required for 9.x compat

Co-Authored-By: Claude <noreply@anthropic.com>
@chrisgervang chrisgervang merged commit 2edcc0d into master Mar 4, 2026
6 checks passed
@chrisgervang chrisgervang deleted the chr/tape-to-vitest branch March 4, 2026 22:51
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.

3 participants