Skip to content

Commit 3d96e5a

Browse files
feat: add nx-based test script to mimic ci
This commit introduces a new testing setup that mimics the CI environment. It uses nx to run tests for npm-app, backend, and common, ensuring a consistent testing workflow. - Adds project.json files for backend and common packages. - Updates npm-app/project.json with a test target. - Modifies the root package.json to include a new test script that streams output and skips the cache. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
1 parent 4d73312 commit 3d96e5a

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

backend/project.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "backend",
3+
"$schema": "../node_modules/nx/schemas/project-schema.json",
4+
"sourceRoot": "src",
5+
"projectType": "application",
6+
"targets": {
7+
"build": {
8+
"executor": "nx:run-commands",
9+
"options": {
10+
"command": "tsc --build",
11+
"cwd": "backend"
12+
}
13+
},
14+
"test": {
15+
"executor": "nx:run-commands",
16+
"options": {
17+
"command": "bun test $(find src -name *.test.ts)",
18+
"cwd": "backend"
19+
}
20+
}
21+
},
22+
"implicitDependencies": ["common"]
23+
}

common/project.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "common",
3+
"$schema": "../node_modules/nx/schemas/project-schema.json",
4+
"sourceRoot": "src",
5+
"projectType": "library",
6+
"targets": {
7+
"build": {
8+
"executor": "nx:run-commands",
9+
"options": {
10+
"command": "tsc",
11+
"cwd": "common"
12+
}
13+
},
14+
"test": {
15+
"executor": "nx:run-commands",
16+
"options": {
17+
"command": "bun test $(find src -name *.test.ts)",
18+
"cwd": "common"
19+
}
20+
}
21+
}
22+
}

npm-app/project.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@
3636
"command": "eslint src/**/*.ts",
3737
"cwd": "npm-app"
3838
}
39+
},
40+
"test": {
41+
"executor": "nx:run-commands",
42+
"options": {
43+
"command": "bun test $(find src -name *.test.ts)",
44+
"cwd": "npm-app"
45+
}
3946
}
4047
},
4148
"implicitDependencies": ["common", "code-map"]

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"test:patch": "bun test test/__src__/patch.test.ts",
3838
"clean": "nx run-many --target=clean --all",
3939
"build": "nx reset && nx run-many --target=build --all",
40+
"test": "nx run-many --target=test --projects=npm-app,backend,common --output-style=stream --skip-nx-cache",
4041
"typecheck": "bun run build"
4142
},
4243
"devDependencies": {

0 commit comments

Comments
 (0)