🔧 fix: repair test, build and CI infrastructure

The vitest suite silently ran zero tests: vitest 4 transpiles with oxc, which
does not pick up `experimentalDecorators` from a tsconfig that excludes the
files being transformed, so every decorator-using suite failed to parse and was
reported as "0 test". A vitest.config.ts enabling legacy decorators brings all
40 existing tests back to life.

- Add vitest.config.ts (oxc legacy decorators + v8 coverage config)
- Type-check test files: move the test/demo exclusions from the base tsconfig
  onto the two build configs, and fix the strict-mode errors this surfaced
- Stop shipping src/example.ts in dist (it invokes runExample() at import time,
  a side effect in a package declaring "sideEffects": false)
- CI: run lint, tests with coverage, build and entry-point smoke checks; drop
  EOL Node 18, add Node 24; commit package-lock.json so `npm ci` works
- Add `verify`, `test:watch` and `build:docs` scripts, and an engines field;
  `build:docs` regenerates the previously hand-maintained docs/cereale.js

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SAcqrz3FcadkYr3xG32CjK
This commit is contained in:
Claude
2026-08-03 23:14:16 +00:00
parent fa75147e4e
commit 66e19f690f
12 changed files with 3327 additions and 25 deletions
+9 -9
View File
@@ -202,8 +202,8 @@ describe('JsonMapper', () => {
const errors = await JsonMapper.validate(user);
expect(errors).toHaveLength(1);
expect(errors[0].property).toBe('username');
expect(errors[0].constraints).toHaveProperty('minLength');
expect(errors[0]!.property).toBe('username');
expect(errors[0]!.constraints).toHaveProperty('minLength');
});
it('should fail on invalid email', async () => {
@@ -215,8 +215,8 @@ describe('JsonMapper', () => {
const errors = await JsonMapper.validate(user);
expect(errors).toHaveLength(1);
expect(errors[0].property).toBe('email');
expect(errors[0].constraints).toHaveProperty('isEmail');
expect(errors[0]!.property).toBe('email');
expect(errors[0]!.constraints).toHaveProperty('isEmail');
});
it('should fail on invalid role (IsIn)', async () => {
@@ -228,8 +228,8 @@ describe('JsonMapper', () => {
const errors = await JsonMapper.validate(user);
expect(errors).toHaveLength(1);
expect(errors[0].property).toBe('roles');
expect(errors[0].constraints).toHaveProperty('isIn');
expect(errors[0]!.property).toBe('roles');
expect(errors[0]!.constraints).toHaveProperty('isIn');
});
it('should skip validation for null optional field', async () => {
@@ -238,7 +238,7 @@ describe('JsonMapper', () => {
user.email = 'john@example.com';
user.active = true;
user.roles = ['user'];
user.age = undefined; // optional
delete user.age; // optional
const errors = await JsonMapper.validate(user);
expect(errors).toHaveLength(0);
@@ -254,8 +254,8 @@ describe('JsonMapper', () => {
const errors = await JsonMapper.validate(user);
expect(errors).toHaveLength(1);
expect(errors[0].property).toBe('age');
expect(errors[0].constraints).toHaveProperty('min');
expect(errors[0]!.property).toBe('age');
expect(errors[0]!.constraints).toHaveProperty('min');
});
});
});