Skip to content

Commit

Permalink
fix: run tests without build packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordy Cabannes committed Jan 9, 2024
1 parent 1374b9e commit 63cfc30
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 122 deletions.
12 changes: 10 additions & 2 deletions jest.config.js → jest-base.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export default {
testTimeout: 10000,
testEnvironment: 'node',
preset: 'ts-jest',
collectCoverage: true,
collectCoverageFrom: ['./src/**/{!(pg|redis),}.ts'],
coverageThreshold: {
Expand All @@ -12,7 +11,16 @@ export default {
statements: 90
}
},
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
tsconfig: '<rootDir>/../../tsconfig-test.json'
},
]
},
moduleNameMapper: {
"@twake/(.*)$": "<rootDir>/../$1/src",
},
'matrix-resolve': '<rootDir>/../matrix-resolve/src'
}
}
1 change: 0 additions & 1 deletion packages/config-parser/jest.config.js

This file was deleted.

5 changes: 5 additions & 0 deletions packages/config-parser/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import jestConfigBase from '../../jest-base.config.js'

export default {
...jestConfigBase
}
16 changes: 3 additions & 13 deletions packages/crypto/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
import jestConfigBase from '../../jest-base.config.js'

export default {
testTimeout: 10000,
testEnvironment: 'node',
preset: 'ts-jest',
collectCoverage: true,
collectCoverageFrom: ['./src/**/*.ts'],
coverageThreshold: {
global: {
branches: 80,
functions: 50,
lines: 90,
statements: 90
}
}
...jestConfigBase
}
18 changes: 4 additions & 14 deletions packages/federation-server/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
import jestConfigBase from '../../jest-base.config.js'

export default {
...jestConfigBase,
testTimeout: 360000,
testEnvironment: 'node',
preset: 'ts-jest',
collectCoverage: true,
collectCoverageFrom: ['./src/**/{!(pg),}.ts'],
coverageThreshold: {
global: {
branches: 80,
functions: 50,
lines: 90,
statements: 90
}
},
moduleNameMapper: {
"@twake/(.*)$": "<rootDir>/../$1/src",
...jestConfigBase.moduleNameMapper,
"node-fetch": "<rootDir>/../../node_modules/node-fetch-jest",
'matrix-resolve': '<rootDir>/../matrix-resolve/src'
},
clearMocks: true
}
19 changes: 3 additions & 16 deletions packages/logger/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
import jestConfigBase from '../../jest-base.config.js'

export default {
testTimeout: 10000,
testEnvironment: 'node',
preset: 'ts-jest',
collectCoverage: true,
collectCoverageFrom: ['./src/**/{!(pg|redis),}.ts'],
coverageThreshold: {
global: {
branches: 80,
functions: 50,
lines: 90,
statements: 90
}
},
moduleNameMapper: {
"@twake/(.*)$": "<rootDir>/../$1/src",
},
...jestConfigBase
}
19 changes: 3 additions & 16 deletions packages/matrix-application-server/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
import jestConfigBase from '../../jest-base.config.js'

export default {
testTimeout: 10000,
testEnvironment: 'node',
preset: 'ts-jest',
collectCoverage: true,
collectCoverageFrom: ['./src/**/*.ts'],
coverageThreshold: {
global: {
branches: 80,
functions: 50,
lines: 90,
statements: 90
}
},
moduleNameMapper: {
"@twake/(.*)$": "<rootDir>/../$1/src",
},
...jestConfigBase,
clearMocks: true,
restoreMocks: true
}
21 changes: 4 additions & 17 deletions packages/matrix-identity-server/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
import jestConfigBase from '../../jest-base.config.js'

export default {
testTimeout: 30000,
testEnvironment: 'node',
preset: 'ts-jest',
collectCoverage: true,
collectCoverageFrom: ['./src/**/{!(pg|redis),}.ts'],
coverageThreshold: {
global: {
branches: 80,
functions: 50,
lines: 90,
statements: 90
}
},
moduleNameMapper: {
'@twake/(.*)$': '<rootDir>/../$1/src',
'matrix-resolve': '<rootDir>/../matrix-resolve/src',
}
...jestConfigBase,
testTimeout: 30000
}
19 changes: 4 additions & 15 deletions packages/matrix-resolve/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
import jestConfigBase from '../../jest-base.config.js'

export default {
testTimeout: 120000,
testEnvironment: 'node',
preset: 'ts-jest',
collectCoverage: true,
collectCoverageFrom: ['./src/**/*.ts'],
coverageThreshold: {
global: {
branches: 80,
functions: 50,
lines: 90,
statements: 90
}
},
...jestConfigBase,
moduleNameMapper: {
"node-fetch": "<rootDir>/../../node_modules/node-fetch-jest"
},
clearMocks: true
}
}
16 changes: 3 additions & 13 deletions packages/retry-promise/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
import jestConfigBase from '../../jest-base.config.js'

export default {
testTimeout: 10000,
testEnvironment: 'node',
preset: 'ts-jest',
collectCoverage: true,
collectCoverageFrom: ['./src/**/*.ts'],
coverageThreshold: {
global: {
branches: 80,
functions: 50,
lines: 90,
statements: 90
}
},
...jestConfigBase
}
18 changes: 4 additions & 14 deletions packages/tom-server/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
import jestConfigBase from '../../jest-base.config.js'

export default {
...jestConfigBase,
testTimeout: 120000,
testEnvironment: 'node',
preset: 'ts-jest',
collectCoverage: true,
collectCoverageFrom: ['./src/**/{!(pg),}.ts'],
coverageThreshold: {
global: {
branches: 80,
functions: 50,
lines: 90,
statements: 90
}
},
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
moduleNameMapper: {
"@twake/(.*)$": "<rootDir>/../$1/src",
...jestConfigBase.moduleNameMapper,
"node-fetch": "<rootDir>/../../node_modules/node-fetch-jest",
'matrix-resolve': '<rootDir>/../matrix-resolve/src'
},
clearMocks: true
}
10 changes: 9 additions & 1 deletion tsconfig-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
"sourceMap": true,
"noEmitOnError": true,
"resolveJsonModule":true,
"declaration": true
"declaration": true,
"paths": {
"@twake/config-parser": ["./packages/config-parser/src"],
"@twake/crypto": ["./packages/crypto/src"],
"@twake/logger": ["./packages/logger/src"],
"@twake/matrix-application-server": ["./packages/matrix-application-server/src"],
"@twake/matrix-identity-server": ["./packages/matrix-identity-server/src"],
"matrix-resolve": ["./packages/matrix-resolve/src"]
}
}
}

0 comments on commit 63cfc30

Please sign in to comment.