Skip to content

Commit 8897814

Browse files
committed
Get common utilities tests working
Signed-off-by: Connor Avery <[email protected]>
1 parent f330d7e commit 8897814

File tree

5 files changed

+11
-4
lines changed

5 files changed

+11
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ It is called by an Apigee proxy that is defined at <https://github.com/NHSDigita
2121
- `packages/capabilityStatement/` Returns a static capability statement.
2222
- `packages/serviceSearchClient/` Module for connecting to service search.
2323
- `packages/distanceSelling/` Module for using Service Search client and enriching the data being returned.
24-
- `packages/common` Module containing commonly referenced functions, data types and configuration data.
24+
- `packages/common/utilities` Module containing commonly referenced functions, data types and configuration data.
2525
- `packages/common/tests` Module that contains some test data used for tests in other modules.
2626
- `postman/` Contains a postman collection for interacting with the API.
2727
- `scripts/` Utilities helpful to developers of this specification.

packages/common/utilities/jest.config.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ import defaultConfig from "../../../jest.default.config"
33

44
const jestConfig: JestConfigWithTsJest = {
55
...defaultConfig,
6-
rootDir: "./"
6+
rootDir: "./",
7+
moduleNameMapper: {
8+
"^(\\.{1,2}/.*)\\.js$": "$1",
9+
"^@common/tests$": "<rootDir>/../tests/lib/index.js",
10+
"^@common/tests/(.*)$": "<rootDir>/../tests/lib/$1.js",
11+
"^@common/utilities$": "<rootDir>/lib/index.js",
12+
"^@common/utilities/(.*)$": "<rootDir>/lib/$1.js"
13+
}
714
}
815

916
export default jestConfig

packages/common/utilities/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"license": "MIT",
99
"type": "module",
1010
"scripts": {
11-
"unit": "echo 'No tests in common/utilities package - it provides shared utilities only'",
11+
"unit": "POWERTOOLS_DEV=true NODE_OPTIONS=--experimental-vm-modules jest --no-cache --coverage",
1212
"lint": "eslint --max-warnings 0 --fix --config ../../../eslint.config.mjs .",
1313
"compile": "tsc",
1414
"test": "npm run compile && npm run unit",
File renamed without changes.

packages/common/utilities/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"resolveJsonModule": true
77
},
88
"include": ["src/**/*", "src/**/*.json"],
9-
"exclude": ["node_modules", "testing"]
9+
"exclude": ["node_modules", "tests"]
1010
}

0 commit comments

Comments
 (0)