Testing
Testing
Overview
Clockwork packages are tested upstream with Vitest. In your project, test your own systems/plugins that use Clockwork APIs.
Recommended test layout:
src/**/*.test.tsorsrc/**/*.test.jstests/**/*.test.tsortests/**/*.test.js
Run Tests in Your Project
npm test
Typical Validation Commands
npm run lint
npm run typecheck
npm test
npm run build
Example Runtime Smoke Test
import { describe, it } from 'vitest'
import { AppBuilder, HeadlessRendererPlugin } from 'qti-clockwork-app'
describe('clockwork runtime', () => {
it('runs one frame', async () => {
const app = new AppBuilder().use(HeadlessRendererPlugin).build()
app.run()
await app.step(1 / 60)
await app.shutdown()
})
})
CI Guidance
Use the same commands in CI that you run locally (lint, typecheck, test, build).
Notes
- If your tests use path aliases, mirror alias config between
tsconfig.json/jsconfig.jsonand your test runner. - If you consume ESM builds, ensure your test runtime supports your module format.
Maintainer Note
The Clockwork source repository has additional workspace-level Vitest configuration for package development.
If tests fail due to module resolution, verify alias entries in your Vitest config (vitest.config.ts or vitest.config.js).