Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

Commit

Permalink
build: Add separate tsconfig for test script
Browse files Browse the repository at this point in the history
The definitions for `require` and `module` clash with `@types/node`,
which is needed to run the test script (`run-tests.ts`).
To keep the setup working, separate `tsconfig.json` into two files:

- `tsconfig.json` is used to compile `src/` and `test-d/`.
- `tsconfig.test.json` is used to compiel `run-tests.ts`.

Also make ts-node use `tsconfig.test.json` for this.
(Hopefully, all this mess can be removed once #21 is merged.)
  • Loading branch information
pastelmind committed Apr 24, 2021
1 parent 6f15228 commit 8e0be91
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"scripts": {
"lint": "gts lint",
"fix": "gts fix",
"test": "ts-node run-tests.ts",
"test": "ts-node --project tsconfig.test.json run-tests.ts",
"posttest": "npm run lint"
},
"repository": {
Expand Down
6 changes: 4 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": "./node_modules/gts/tsconfig-google.json",
"compilerOptions": {
"resolveJsonModule": true
}
// We don't want @types/node to interfere with our own types (e.g. require())
"types": []
},
"include": ["src", "test-d"]
}
7 changes: 7 additions & 0 deletions tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "gts/tsconfig-google.json",
"compilerOptions": {
"resolveJsonModule": true
},
"exclude": ["src", "test-d"]
}

0 comments on commit 8e0be91

Please sign in to comment.