Skip to content

chore(vis-core): Adding WebGPU Vitest configuration - #302

Open
Jarbuckle wants to merge 1 commit into
mainfrom
joel/webgpu-test-setup
Open

Jarbuckle wants to merge 1 commit into
mainfrom
joel/webgpu-test-setup

Conversation

@Jarbuckle

@Jarbuckle Jarbuckle commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

chore(vis-core): Adding WebGPU Vitest configuration

What

Adds a Vitest setup file defining the WebGPU runtime globals (GPUBufferUsage, GPUShaderStage, GPUTextureUsage, GPUColorWrite) and Float16Array, none of which Node provides. The existing filter query path already dereferences GPUBufferUsage, and the WebGPU rendering modules landing in follow-up PRs depend on all of them.

Base of the new WebGPU Rendering System stack; memory, resources, renderer, and the demo page follow.

PR Checklist

  • Is your PR title following our conventional commit naming recommendations?
  • Have you filled in the PR Description Template?
  • Is your branch up to date with the latest in main?
  • Do the CI checks pass successfully?
  • Have you smoke tested the example applications?
  • Did you check that the changes meet accessibility standards?
  • Have you tested the application on these browsers?
    • Chrome (Fully supported)
    • Firefox (Major bug fixes supported)
    • Safari (Major bug fixes supported)

@Jarbuckle
Jarbuckle requested a review from a team as a code owner September 9, 2026 19:17
@Jarbuckle
Jarbuckle requested review from chrisj and froyo-np September 9, 2026 19:17
@Jarbuckle
Jarbuckle added this pull request to stack #306 September 9, 2026 19:27
@Jarbuckle Jarbuckle changed the title chore(vis-core): Adding WebGPU testing setup chore(vis-core): Adding WebGPU Vitest configuration Sep 9, 2026
@Jarbuckle Jarbuckle added the experimental An experiment, not necessarily ever going to be merged, at least in its current form. label Sep 9, 2026

@lanesawyer lanesawyer left a comment

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.

One simplification and a question

Comment thread vitest.config.ts

export default defineConfig({
test: {
setupFiles: [fileURLToPath(new URL('./vitest.setup.ts', import.meta.url))],

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.

Can this not be just the string?

Docs suggest it'll resolve just fine: https://vitest.dev/guide/learn/setup-teardown.html#setup-files

Suggested change
setupFiles: [fileURLToPath(new URL('./vitest.setup.ts', import.meta.url))],
setupFiles: ['./vitest.setup.ts']

Comment thread vitest.setup.ts
* Vitest global setup. Polyfills typed-array constructors and WebGPU globals that webgpu-utils
* references at module-init time but Node hasn't exposed by default yet.
*
* `Float16Array` is stage-4 ES but in Node 22.x requires the `--js-float16array` flag. We map it

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.

What about Node 24? Or 26 (which becomes LTS in a few weeks)? Not sure if we can simplify or remove pieces if the newer versions have better support?

@Jarbuckle Jarbuckle Sep 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ahhh, very good callout! It does look like it was released as stable in Node 24, so parts of this may be unnecessary -- sweet!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

experimental An experiment, not necessarily ever going to be merged, at least in its current form.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants