LessJS tests should protect the framework contract: route scanning, DSD output, island metadata, middleware scope, SSG post-processing and package boundaries.
Application code can use Deno's built-in test runner. Start with units for pure logic and API handlers, then add build smoke tests for the routes that matter most.
deno test --allow-read --allow-write --allow-env --allow-net --allow-run
import { assertEquals } from 'jsr:@std/assert';
import { extractParams, parseQuery } from '@lessjs/core';
Deno.test('extractParams parses dynamic segments', () => {
const params = extractParams('/users/:id', '/users/42');
assertEquals(params, { id: '42' });
});
Deno.test('parseQuery returns plain values', () => {
const query = parseQuery(new URL('https://example.com/?page=2'));
assertEquals(query, { page: '2' });
});
A static-first framework needs at least one test that builds the site and verifies generated HTML. This catches route scanner, SSR, client island and SSG integration problems.
deno task build
# then inspect dist/index.html, dist/client, manifest, CSP/PWA tags as needed
For this repository, the package-level CI baseline is intentionally narrower than a full-root lint/typecheck because generated docs/public assets can have different tool constraints.
deno test --allow-read --allow-write --allow-env --allow-net --allow-run
deno lint packages/
deno fmt --check packages/
deno check packages/core/src/index.ts packages/rpc/src/index.ts packages/ui/src/index.ts
deno task build:all
| Area | Test |
|---|---|
| Middleware | Root _middleware.ts protects / and nested routes. |
| SSG CSP | Static HTML receives CSP meta when middleware CSP is configured. |
| Nested islands | app/islands/posts/index.ts resolves to the scanned file path. |
| Strategies | Package and default island strategies are represented in the generated client entry. |
| Renderer | Unsafe HTML, attributes, nested DSD and Lit adapter output have explicit expectations. |
Use browser tests when behavior depends on Custom Element upgrade, IntersectionObserver, idle loading, service workers or real DOM semantics. Unit tests are not enough for island strategy work.