Skip to content

The open alternative to Salesforce, designed for AI.

chore(create-twenty-app): align scaffold with unified app test/lint/typecheck configs (#22128)

martmullfa008b47286c
diff --git a/packages/create-twenty-app/jest.config.mjs b/packages/create-twenty-app/jest.config.mjs
index 0ac756b412f..ee70ebd6536 100644
--- a/packages/create-twenty-app/jest.config.mjs
+++ b/packages/create-twenty-app/jest.config.mjs
@@ -24,6 +24,12 @@ const jestConfig = {
'<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',
diff --git a/packages/create-twenty-app/src/constants/template/README.md b/packages/create-twenty-app/src/constants/template/README.md
index 4728d9ffa09..5164f08185d 100644
--- a/packages/create-twenty-app/src/constants/template/README.md
+++ b/packages/create-twenty-app/src/constants/template/README.md
@@ -13,6 +13,9 @@ Run `yarn twenty help` to list all available commands.
- `yarn twenty dev` - Start the development server and sync your app
- `yarn twenty docker:status` - Check the local Twenty server status
- `yarn twenty docker:start` - Start the local Twenty server
+- `yarn lint` - Lint the project with oxlint
+- `yarn typecheck` - Type-check the project
+- `yarn test:unit` - Run unit tests
- `yarn test` - Run integration tests
## Learn More
diff --git a/packages/create-twenty-app/src/constants/template/github/workflows/ci.yml b/packages/create-twenty-app/src/constants/template/github/workflows/ci.yml
index 9112ecb495c..95e85ef31a2 100644
--- a/packages/create-twenty-app/src/constants/template/github/workflows/ci.yml
+++ b/packages/create-twenty-app/src/constants/template/github/workflows/ci.yml
@@ -41,6 +41,15 @@ jobs:
- name: Install dependencies
run: yarn install --immutable
+ - name: Lint
+ run: yarn lint
+
+ - name: Typecheck
+ run: yarn typecheck
+
+ - name: Unit tests
+ run: yarn test:unit
+
- name: Run integration tests
run: yarn test
env:
diff --git a/packages/create-twenty-app/src/constants/template/package.json b/packages/create-twenty-app/src/constants/template/package.json
index 826d228bee6..c9ba7fd636e 100644
--- a/packages/create-twenty-app/src/constants/template/package.json
+++ b/packages/create-twenty-app/src/constants/template/package.json
@@ -8,24 +8,28 @@
"yarn": ">=4.0.2"
},
"keywords": [],
- "packageManager": "[email protected]",
+ "packageManager": "[email protected]",
"scripts": {
"twenty": "twenty",
"lint": "oxlint -c .oxlintrc.json .",
"lint:fix": "oxlint --fix -c .oxlintrc.json .",
+ "typecheck": "tsgo --noEmit -p tsconfig.spec.json",
"test": "vitest run",
- "test:watch": "vitest"
+ "test:watch": "vitest",
+ "test:unit": "vitest run --config vitest.unit.config.ts"
},
"dependencies": {},
"devDependencies": {
"@types/node": "^24.7.2",
"@types/react": "^19.0.0",
+ "@typescript/native-preview": "^7.0.0-dev.20260116.1",
"oxlint": "^0.16.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"twenty-client-sdk": "TO-BE-GENERATED",
"twenty-sdk": "TO-BE-GENERATED",
"typescript": "^5.9.3",
- "vitest": "^3.1.1"
+ "vite-tsconfig-paths": "^4.2.1",
+ "vitest": "^4.0.0"
}
}
diff --git a/packages/create-twenty-app/src/constants/template/src/__tests__/application-config.test.ts b/packages/create-twenty-app/src/constants/template/src/__tests__/application-config.test.ts
new file mode 100644
index 00000000000..fdc1c6235c9
--- /dev/null
+++ b/packages/create-twenty-app/src/constants/template/src/__tests__/application-config.test.ts
@@ -0,0 +1,14 @@
+import {
+ APP_DESCRIPTION,
+ APP_DISPLAY_NAME,
+ APPLICATION_UNIVERSAL_IDENTIFIER,
+} from 'src/constants/universal-identifiers';
+import { describe, expect, it } from 'vitest';
+
+describe('application identifiers', () => {
+ it('should expose the application metadata constants', () => {
+ expect(APP_DISPLAY_NAME).toBeTruthy();
+ expect(typeof APP_DESCRIPTION).toBe('string');
+ expect(APPLICATION_UNIVERSAL_IDENTIFIER).toBeTruthy();
+ });
+});
diff --git a/packages/create-twenty-app/src/constants/template/tsconfig.json b/packages/create-twenty-app/src/constants/template/tsconfig.json
index f71645f97ac..abacf4dcf6d 100644
--- a/packages/create-twenty-app/src/constants/template/tsconfig.json
+++ b/packages/create-twenty-app/src/constants/template/tsconfig.json
@@ -16,7 +16,7 @@
"alwaysStrict": true,
"noImplicitAny": true,
"strictBindCallApply": false,
- "target": "es2018",
+ "target": "es2020",
"module": "esnext",
"lib": ["es2020", "dom"],
"skipLibCheck": true,
diff --git a/packages/create-twenty-app/src/constants/template/vitest.config.ts b/packages/create-twenty-app/src/constants/template/vitest.config.ts
index a22f3b6c310..055af77dbec 100644
--- a/packages/create-twenty-app/src/constants/template/vitest.config.ts
+++ b/packages/create-twenty-app/src/constants/template/vitest.config.ts
@@ -1,3 +1,4 @@
+import tsconfigPaths from 'vite-tsconfig-paths';
import { defineConfig } from 'vitest/config';
const TWENTY_API_URL = process.env.TWENTY_API_URL ?? 'http://localhost:2020';
@@ -10,9 +11,12 @@ process.env.TWENTY_API_URL = TWENTY_API_URL;
process.env.TWENTY_API_KEY = TWENTY_API_KEY;
export default defineConfig({
- resolve: {
- tsconfigPaths: true,
- },
+ plugins: [
+ tsconfigPaths({
+ projects: ['tsconfig.spec.json'],
+ ignoreConfigErrors: true,
+ }),
+ ],
test: {
testTimeout: 120_000,
hookTimeout: 120_000,
diff --git a/packages/create-twenty-app/src/constants/template/vitest.unit.config.ts b/packages/create-twenty-app/src/constants/template/vitest.unit.config.ts
new file mode 100644
index 00000000000..e0d140015bb
--- /dev/null
+++ b/packages/create-twenty-app/src/constants/template/vitest.unit.config.ts
@@ -0,0 +1,14 @@
+import tsconfigPaths from 'vite-tsconfig-paths';
+import { defineConfig } from 'vitest/config';
+
+export default defineConfig({
+ plugins: [
+ tsconfigPaths({
+ projects: ['tsconfig.spec.json'],
+ ignoreConfigErrors: true,
+ }),
+ ],
+ test: {
+ include: ['src/**/*.test.ts'],
+ },
+});
diff --git a/packages/create-twenty-app/tsconfig.json b/packages/create-twenty-app/tsconfig.json
index a98bfce2e36..baa88df3959 100644
--- a/packages/create-twenty-app/tsconfig.json
+++ b/packages/create-twenty-app/tsconfig.json
@@ -26,6 +26,7 @@
],
"exclude": [
"src/constants/template/vitest.config.ts",
+ "src/constants/template/vitest.unit.config.ts",
"src/constants/template/src/**",
"src/constants/template/tsconfig.spec.json"
]
diff --git a/packages/create-twenty-app/tsconfig.lib.json b/packages/create-twenty-app/tsconfig.lib.json
index 1e33d4aed74..3fcb1939791 100644
--- a/packages/create-twenty-app/tsconfig.lib.json
+++ b/packages/create-twenty-app/tsconfig.lib.json
@@ -21,6 +21,7 @@
"**/__tests__/**",
"src/constants/template/src/**",
"src/constants/template/vitest.config.ts",
+ "src/constants/template/vitest.unit.config.ts",
"src/constants/template/tsconfig.spec.json"
]
}