You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migrate tests/workflows to node:test and update docs
Replace the legacy Jest-based test setup and dotenv loader with Node's built-in test runner and native env-file flags. GitHub Actions workflows were reworked: job 'test' renamed to 'local_seams', new 'integration_seams' (creates .env from secrets, sets up Node 24, caches npm, runs npm run test:integration) and coordinated bump_version job added; CD jobs now run npm run test:integration for smoke checks. Documentation and guides (.github/copilot-instructions.md, CONFIG.md, CONTRIBUTING.md, README.md) updated to reflect Node native env-file usage, updated test script names (test:local, test:integration, test:coverage) and testing guidance. Removed import of env-loader from bin/tpen3_services.js. Large set of legacy Jest tests under __tests__ and various class test folders were removed and replaced by new test suites under test/local and test/integration; package.json/package-lock were updated accordingly.
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+8-12Lines changed: 8 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ TPEN Services is a Node.js Express API service for TPEN3 (Transcription for Pale
16
16
17
17
### Environment Configuration
18
18
19
-
TPEN Services uses a layered configuration approach with `--import ./env-loader.js` using the dotenv package:
19
+
TPEN Services uses a layered configuration approach with Node native env-file flags:
20
20
21
21
-`config.env` - Safe defaults (committed to repo, no secrets)
22
22
- Works out-of-the-box for local Docker/MongoDB/MariaDB
@@ -33,10 +33,10 @@ TPEN Services uses a layered configuration approach with `--import ./env-loader.
33
33
- Contains actual secrets and environment-specific values
34
34
- Overrides values from `config.env`
35
35
36
-
Configuration loading order (via `--import ./env-loader.js` using the dotenv package):
36
+
Configuration loading order (via Node CLI env-file flags in npm scripts):
37
37
38
38
1.`config.env` is loaded first (provides safe defaults)
39
-
2.`.env.{NODE_ENV}` is loaded second (environment-specific: .env.development, .env.production, .env.test)
39
+
2.`.env.development` is loaded second (development defaults)
40
40
3.`.env` is loaded last (local/server overrides - HIGHEST PRIORITY)
41
41
42
42
This allows developers to work immediately with sensible defaults while keeping secrets out of the repository.
@@ -48,19 +48,15 @@ This allows developers to work immediately with sensible defaults while keeping
48
48
- Start the application: `npm start` or `npm run dev`
49
49
- Test the root endpoint: `curl http://localhost:3011/` -- should return HTML containing the TPEN3 Services index (heading + welcome text)
50
50
- Run unit tests that don't require databases: `npm run unitTests` -- many tests pass without database connections
51
-
- Run existence tests: `npm run existsTests` -- validates route registration and class imports
52
51
- Run all tests: `npm run allTests` -- Full test suite confirming full app functionality
53
52
- ALWAYS wait for full test completion. Tests may appear to hang but should complete within 2 minutes.
54
53
- NOTE: Application may crash after serving initial requests due to database connection attempts - this is expected behavior without running MongoDB/MariaDB.
55
54
56
55
### Test Categories Available
57
56
-`npm run allTests` -- Full test suite which requires .env settings
58
-
-`npm run unitTests` -- Core unit tests (some require databases)
59
-
-`npm run existsTests` -- Route and class existence validation (database-independent)
60
-
-`npm run functionsTests` -- Function-level tests
61
-
-`npm run E2Etests` -- End-to-end API tests
62
-
-`npm run dbTests` -- Database-specific tests (require running databases)
63
-
-`npm run authTest` -- Authentication tests (require Auth0 configuration)
57
+
-`npm run unitTests` -- Fast local seam checks
58
+
-`npm run E2Etests` -- CI-oriented integration seam checks
59
+
-`npm run test:coverage` -- Coverage report via c8
64
60
65
61
### Expected Test Behavior
66
62
- Tests requiring databases will timeout/fail without MongoDB/MariaDB running
@@ -108,8 +104,8 @@ Required for external services:
108
104
1. Do not overwrite the existing .env file. If an .env file does not exist or is not populated then copy environment configuration: `cp .env.development .env`
109
105
2. Install dependencies with `npm install`
110
106
3. Make code changes
111
-
4. Test with: `npm run existsTests` (fast, database-independent)
112
-
5. For all other tests use `npm run allTests`
107
+
4. Test with: `npm run unitTests` (fast, database-independent)
108
+
5. For full validation use `npm run allTests`
113
109
6. Test manually: `curl http://localhost:3011/` and relevant endpoints
114
110
115
111
NEVER CANCEL long-running commands. Application builds and tests are designed to complete within documented timeouts. Always wait for completion to ensure accurate validation of changes.
Copy file name to clipboardExpand all lines: CONFIG.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Configuration Architecture
4
4
5
-
TPEN Services uses a layered configuration approach to separate safe defaults from environment-specific secrets. Configuration is loaded using `--import ./env-loader.js` with the dotenv package:
5
+
TPEN Services uses a layered configuration approach to separate safe defaults from environment-specific secrets. Configuration is loaded using Node native env-file flags in npm scripts:
6
6
7
7
1.**`config.env`** (committed) - Safe defaults for development
0 commit comments