forked from ceph/ceph
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mgr/dashboard: adapt and refactor jest test files
Use the `configureTestBed` as the placeholder for adding the declarations, imports... that is required for the unit tests to run Fixes: https://tracker.ceph.com/issues/62844 Signed-off-by: Nizamudeen A <[email protected]> (cherry picked from commit e2626fb)
- Loading branch information
1 parent
54c06c6
commit 50a91fa
Showing
37 changed files
with
11,883 additions
and
8,025 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,39 @@ | ||
const esModules = ['@angular', '@ngrx', '@progress', 'simplebar', 'lodash-es', 'react-syntax-highlighter', 'swagger-client', '@ng-bootstrap']; | ||
const esModules = [ | ||
'@angular', | ||
'@ngrx', | ||
'@progress', | ||
'simplebar', | ||
'lodash-es', | ||
'react-syntax-highlighter', | ||
'swagger-client', | ||
'@ng-bootstrap' | ||
]; | ||
const jestConfig = { | ||
globals: { | ||
'ts-jest': { | ||
useESM: true, | ||
stringifyContentPathRegex: '\\.(html|svg)$', | ||
tsconfig: '<rootDir>/tsconfig.spec.json', | ||
isolatedModules: true | ||
}, | ||
}, | ||
globalSetup: 'jest-preset-angular/global-setup', | ||
moduleNameMapper: { | ||
"\\.scss$": "identity-obj-proxy", | ||
"~/(.*)$": "<rootDir>/src/$1" | ||
}, | ||
moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs', 'cjs'], | ||
preset: "jest-preset-angular", | ||
setupFilesAfterEnv: [ | ||
"<rootDir>/src/setupJest.ts" | ||
], | ||
transformIgnorePatterns: [ | ||
"node_modules/(?!.*\\.mjs$|".concat(esModules.join('|'), ")") | ||
], | ||
transform: { | ||
"^.+\\.(ts|html|mjs)$": "jest-preset-angular", | ||
"^.+\\.(js)$": "babel-jest" | ||
}, | ||
setupFiles: [ | ||
"jest-canvas-mock" | ||
], | ||
coverageReporters: [ | ||
"cobertura", | ||
"html" | ||
], | ||
modulePathIgnorePatterns: [ | ||
"<rootDir>/coverage/", | ||
"<rootDir>/node_modules/simplebar-angular", | ||
], | ||
testMatch: [ | ||
"**/*.spec.ts" | ||
], | ||
testRunner: 'jest-jasmine2' | ||
globals: { | ||
'ts-jest': { | ||
useESM: true, | ||
stringifyContentPathRegex: '\\.(html|svg)$', | ||
tsconfig: '<rootDir>/tsconfig.spec.json', | ||
isolatedModules: true | ||
} | ||
}, | ||
globalSetup: 'jest-preset-angular/global-setup', | ||
moduleNameMapper: { | ||
'\\.scss$': 'identity-obj-proxy', | ||
'~/(.*)$': '<rootDir>/src/$1' | ||
}, | ||
moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs', 'cjs'], | ||
preset: 'jest-preset-angular', | ||
setupFilesAfterEnv: ['<rootDir>/src/setupJest.ts'], | ||
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$|'.concat(esModules.join('|'), ')')], | ||
transform: { | ||
'^.+\\.(ts|html|mjs)$': 'jest-preset-angular', | ||
'^.+\\.(js)$': 'babel-jest' | ||
}, | ||
setupFiles: ['jest-canvas-mock'], | ||
coverageReporters: ['cobertura', 'html'], | ||
modulePathIgnorePatterns: ['<rootDir>/coverage/', '<rootDir>/node_modules/simplebar-angular'], | ||
testMatch: ['**/*.spec.ts'], | ||
testRunner: 'jest-jasmine2' | ||
}; | ||
module.exports = jestConfig; |
Oops, something went wrong.