[MIGRATION] - Moving mocha to jest

This commit is contained in:
VitoAlbano
2024-11-14 19:38:51 +00:00
committed by Vito Albano
parent 3cb250eeea
commit 76fecf705a
6 changed files with 966 additions and 4 deletions

22
lib/js-api/jest.config.ts Normal file
View File

@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'js-api',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
},
coverageDirectory: '../../../coverage/libs/js-api',
transform: {
'^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular',
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
};

View File

@@ -104,7 +104,7 @@
},
"dependsOn": ["build"]
},
"test": {
"test-old-mocha": {
"executor": "nx:run-commands",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
@@ -117,7 +117,14 @@
"codeCoverage": true
}
}
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "lib/js-api/jest.config.ts",
"passWithNoTests": true
}}
},
"tags": []
}

View File

@@ -0,0 +1,18 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import 'jest-preset-angular/setup-jest';