-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: rework unit tests to separate dom and node tests
- Loading branch information
Showing
10 changed files
with
65 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
const getJestConfig = require('../../../jest.config.ut').getJestConfig; | ||
|
||
/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */ | ||
module.exports = { | ||
...getJestConfig(__dirname, true), | ||
displayName: require('./package.json').name, | ||
fakeTimers: { | ||
enableGlobally: true, | ||
// TODO try to make date utils work with fake Date | ||
doNotFake: ['Date'] | ||
} | ||
projects: [ | ||
'<rootDir>/testing/jest.config.ut.js', | ||
'<rootDir>/testing/jest.config.ut.builders.js' | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const path = require('node:path'); | ||
const getJestConfig = require('../../../../jest.config.ut').getJestConfig; | ||
const rootDir = path.join(__dirname, '..'); | ||
|
||
/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */ | ||
module.exports = { | ||
...getJestConfig(rootDir, false), | ||
displayName: `${require('../package.json').name}/builders`, | ||
rootDir, | ||
setupFilesAfterEnv: [], | ||
testPathIgnorePatterns: [ | ||
'<rootDir>/.*/templates/.*', | ||
'<rootDir>/src/.*', | ||
'\\.it\\.spec\\.ts$' | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const path = require('node:path'); | ||
const getJestConfig = require('../../../../jest.config.ut').getJestConfig; | ||
const rootDir = path.join(__dirname, '..'); | ||
|
||
/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */ | ||
module.exports = { | ||
...getJestConfig(rootDir, true), | ||
displayName: require('../package.json').name, | ||
rootDir, | ||
testPathIgnorePatterns: [ | ||
'<rootDir>/.*/templates/.*', | ||
'<rootDir>/schematics/.*', | ||
'<rootDir>/builders/.*', | ||
'\\.it\\.spec\\.ts$' | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
import '@o3r/test-helpers/setup-jest'; | ||
import 'jest-preset-angular/setup-jest'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* Run all fake timers before resolving the promise | ||
* @param promise | ||
*/ | ||
export function awaitFakeTimers<T>(promise: PromiseLike<T>): Promise<T> { | ||
return jest.runAllTimersAsync().then(() => promise); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters