[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

4
jest.preset.js Normal file
View File

@@ -0,0 +1,4 @@
// eslint-disable
const nxPreset = require('@nx/jest/preset').default;
module.exports = {...nxPreset };

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

914
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -145,6 +145,7 @@
"jasmine-marbles": "^0.9.2", "jasmine-marbles": "^0.9.2",
"jasmine-reporters": "^2.5.2", "jasmine-reporters": "^2.5.2",
"jasmine-spec-reporter": "7.0.0", "jasmine-spec-reporter": "7.0.0",
"jest-preset-angular": "^14.2.4",
"js-yaml": "^4.0.0", "js-yaml": "^4.0.0",
"jsdom": "^25.0.1", "jsdom": "^25.0.1",
"karma": "6.4.4", "karma": "6.4.4",