Skip to content

Commit

Permalink
fix: test config
Browse files Browse the repository at this point in the history
Signed-off-by: Ariel Gentile <[email protected]>
  • Loading branch information
genaris committed Oct 18, 2024
1 parent 8ecc2bd commit e1c487c
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 41 deletions.
22 changes: 1 addition & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"prettier": "prettier '**/*.+(js|json|ts|tsx|md|yml|yaml)'",
"format": "yarn prettier --write",
"check-format": "yarn prettier --list-different",
"test": "yarn workspaces run test",
"test": "yarn workspaces run test --passWithNoTests",
"lint": "eslint --ignore-path .gitignore --ignore-pattern '**/esm/' .",
"validate": "yarn lint && yarn check-types && yarn check-format"
},
Expand All @@ -41,25 +41,5 @@
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.1.3"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": ".",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "./coverage",
"testEnvironment": "node",
"roots": [
"<rootDir>/packages/"
]
}
}
24 changes: 24 additions & 0 deletions packages/client/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { Config } from '@jest/types'

const config: Config.InitialOptions = {
preset: 'ts-jest',
testEnvironment: 'node',
coveragePathIgnorePatterns: ['/build/', '/node_modules/', '/__tests__/', 'tests'],
coverageDirectory: '<rootDir>/coverage/',
testMatch: ['**/?(*.)+(spec|test).[tj]s?(x)'],
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
isolatedModules: true,
},
],
'^.+\\.jsx?$': require.resolve('babel-jest'),
},
moduleNameMapper: {
// Force module uuid to resolve with the CJS entry point, because Jest does not support package.json.exports. See https://github.com/uuidjs/uuid/issues/451
uuid: require.resolve('uuid'),
},
}

export default config
20 changes: 20 additions & 0 deletions packages/server/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { Config } from '@jest/types'

const config: Config.InitialOptions = {
preset: 'ts-jest',
testEnvironment: 'node',
coveragePathIgnorePatterns: ['/build/', '/node_modules/', '/__tests__/', 'tests'],
coverageDirectory: '<rootDir>/coverage/',
testMatch: ['**/?(*.)+(spec|test).[tj]s?(x)'],
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
isolatedModules: true,
},
],
},
moduleNameMapper: { '^uuid$': 'uuid' },
}

export default config
20 changes: 0 additions & 20 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,26 +69,6 @@
"tsconfig-paths": "^4.2.0",
"typescript": "^5.1.3"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": ".",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "./coverage",
"testEnvironment": "node",
"roots": [
"<rootDir>/packages/"
]
},
"publishConfig": {
"access": "restricted"
}
Expand Down

0 comments on commit e1c487c

Please sign in to comment.