fa008b4728
## What We have unified the unit + integration test, lint, and typecheck configuration across `packages/twenty-apps/internal` and `packages/twenty-apps/public`. This PR updates the `create-twenty-app` scaffolded project template so a freshly generated app complies with that same setup. ### Scaffold template changes (`packages/create-twenty-app/src/constants/template/`) - **`package.json`**: add `typecheck` (`tsgo --noEmit -p tsconfig.spec.json`) and `test:unit` scripts; add `@typescript/native-preview` + `vite-tsconfig-paths` devDeps; bump `vitest` → `^4.0.0` and `packageManager` → `yarn@4.13.0`. - **`vitest.config.ts`**: resolve path aliases via the `vite-tsconfig-paths` plugin (matching the unified apps) instead of the ad-hoc `resolve.tsconfigPaths`. - **`vitest.unit.config.ts`** (new): unit test config targeting `src/**/*.test.ts`, identical to existing apps. - **`tsconfig.json`**: `moduleResolution: node → bundler`, `target: es2018 → es2020`. - **`src/__tests__/application-config.test.ts`** (new): a sample unit test so a fresh scaffold's `test:unit` passes out of the box. - **`.github/workflows/ci.yml`**: run Lint → Typecheck → Unit tests alongside the integration tests, mirroring the central `ci-twenty-apps.yaml` pipeline. - **`README.md`**: document the new `lint` / `typecheck` / `test:unit` commands. ### CLI package changes - **`tsconfig.json` / `tsconfig.lib.json`**: exclude the new `template/vitest.unit.config.ts` from the CLI's own typecheck/build (just like the existing `vitest.config.ts` exclusion) — its `vitest` / `vite-tsconfig-paths` imports aren't deps of the CLI package. ## Notes - The template's committed `yarn.lock` is an intentional empty seed; the scaffold runs `yarn install` at creation time, so the new deps regenerate cleanly — no lockfile change needed. - The sample unit test asserts `typeof APP_DESCRIPTION === 'string'` (not truthiness) because the description is optional at scaffold time and can be empty. https://claude.ai/code/session_01XiJpkiQG3TiDjKncx2XSQq --- _Generated by [Claude Code](https://claude.ai/code/session_01XiJpkiQG3TiDjKncx2XSQq)_ <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/twentyhq/twenty/pull/22128?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
const jestConfig = {
|
|
displayName: 'create-twenty-app',
|
|
preset: '../../jest.preset.js',
|
|
testEnvironment: 'node',
|
|
transformIgnorePatterns: ['../../node_modules/'],
|
|
transform: {
|
|
'^.+\\.[tj]sx?$': [
|
|
'@swc/jest',
|
|
{
|
|
jsc: {
|
|
parser: { syntax: 'typescript', tsx: false },
|
|
},
|
|
},
|
|
],
|
|
},
|
|
moduleNameMapper: {
|
|
'^@/(.*)$': '<rootDir>/src/$1',
|
|
'^package.json$': '<rootDir>/package.json',
|
|
},
|
|
moduleFileExtensions: ['ts', 'js'],
|
|
extensionsToTreatAsEsm: ['.ts'],
|
|
coverageDirectory: './coverage',
|
|
testMatch: [
|
|
'<rootDir>/src/**/__tests__/**/*.(test|spec).{js,ts}',
|
|
'<rootDir>/src/**/?(*.)(test|spec).{js,ts}',
|
|
],
|
|
// The scaffold template ships its own tests that run under the generated
|
|
// project's vitest, not this package's jest, so ignore the template directory.
|
|
testPathIgnorePatterns: [
|
|
'/node_modules/',
|
|
'<rootDir>/src/constants/template/',
|
|
],
|
|
collectCoverageFrom: [
|
|
'src/**/*.{ts,js}',
|
|
'!src/**/*.d.ts',
|
|
'!src/cli.ts', // Exclude CLI entry point from coverage
|
|
],
|
|
coverageThreshold: {
|
|
global: {
|
|
statements: 1,
|
|
lines: 1,
|
|
functions: 1,
|
|
},
|
|
},
|
|
};
|
|
|
|
export default jestConfig;
|