Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
A14 Script IV. (#4268)
Browse files Browse the repository at this point in the history
* Jest config fixer

* Some manual fixes

* [ci:force]

* Some manual fixes 2.

* [ci:force]

* Some manual fixes 3.

* Some manual fixes 4.

* [ci:force]
  • Loading branch information
popovicsandras authored and Travis CI User committed Aug 15, 2022
1 parent 0143030 commit 3ce43c6
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 205 deletions.
7 changes: 4 additions & 3 deletions app/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const path = require('path');
const getJestConfig = require(__dirname + '/../projects/adf-candidates/testing/jest/jest.get-config');

module.exports = getJestConfig({
Expand All @@ -12,8 +13,8 @@ module.exports = getJestConfig({
path.resolve(__dirname, 'src')
],
globals: {
"ts-jest": {
tsconfig: "<rootDir>/tsconfig.spec.json"
"ts-jest": {
tsconfig: path.resolve(__dirname, 'tsconfig.spec.json'),
}
}
}, path.resolve(__dirname, '..', 'tsconfig.json'), '<rootDir>/../');
}, 'tsconfig.json', path.resolve(__dirname, '..'));
12 changes: 12 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { getJestProjects } = require('@nrwl/jest');

module.exports = {
testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],
transform: {
'^.+\\.(ts|js|html|mjs)$': 'jest-preset-angular',
},
resolver: '@nrwl/jest/plugins/resolver',
moduleFileExtensions: ['ts', 'js', 'html', 'mjs'],
coverageReporters: ['html'],
projects: getJestProjects(),
};
3 changes: 3 additions & 0 deletions jest.preset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const nxPreset = require('@nrwl/jest/preset');

module.exports = { ...nxPreset };
175 changes: 0 additions & 175 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
"devDependencies": {
"@alfresco/adf-cli": "5.0.0-angular.13.2-35854",
"@alfresco/adf-testing": "5.0.0-angular.13.2-35854",
"@angular-builders/jest": "10.0.0",
"@angular-custom-builders/lite-serve": "0.2.2",
"@angular-devkit/architect": "^0.1303.6",
"@angular-devkit/build-angular": "13.3.9",
Expand Down
5 changes: 2 additions & 3 deletions projects/adf-candidates/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const path = require('path');
const getJestConfig = require(__dirname + '/testing/jest/jest.get-config');

module.exports = getJestConfig({
rootDir: path.resolve(__dirname),
coverageDirectory: '<rootDir>/../../../../coverage/modeling-ce/adf-candidates',
collectCoverageFrom: [
'<rootDir>/src/**/*.ts',
Expand All @@ -15,8 +14,8 @@ module.exports = getJestConfig({
path.resolve(__dirname)
],
globals: {
"ts-jest": {
tsconfig: "<rootDir>/tsconfig.spec.json"
"ts-jest": {
tsconfig: path.resolve(__dirname, 'tsconfig.spec.json'),
}
},
}, 'tsconfig.json', path.resolve(__dirname, '../..'));
11 changes: 5 additions & 6 deletions projects/adf-candidates/testing/jest/jest.get-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ const ROOT_DIR = process.cwd();
module.exports = function getJestConfig(config, tsConfigFileName = DEFAULT_TS_CONFIG, rootDirectory = ROOT_DIR) {
const { compilerOptions } = require(path.resolve(rootDirectory, tsConfigFileName));
return {
preset: 'jest-preset-angular',
preset: './jest.preset.js',
testRunner : 'jasmine2',
rootDir: rootDirectory,
rootDir: process.cwd(),
verbose: false,
testURL: 'http://localhost',
setupFilesAfterEnv: [ path.resolve(rootDirectory, 'jest/jest-setup.ts') ],
setupFilesAfterEnv: ['<rootDir>/jest/jest-setup.ts'],
collectCoverage: true,
transformIgnorePatterns: [
'node_modules/(?!.*\\.mjs$|@alfresco\\/js-api|diagram-js|bpmn-js|@ngrx)'
],
transform: {
'^.+\\.(ts|js|html)$': 'jest-preset-angular'
'^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular',
},
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
Expand All @@ -37,8 +37,7 @@ module.exports = function getJestConfig(config, tsConfigFileName = DEFAULT_TS_CO
globals: {
...config.globals,
'ts-jest': {
stringifyContentPathRegex: '\\.html?$',
useESM: true,
stringifyContentPathRegex: '\\.(html|svg)$',
isolatedModules: true,
...config.globals['ts-jest'],
},
Expand Down
5 changes: 2 additions & 3 deletions projects/app-shell/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const path = require('path');
const getJestConfig = require(__dirname + '/../adf-candidates/testing/jest/jest.get-config');

module.exports = getJestConfig({
rootDir: path.resolve(__dirname),
coverageDirectory: '<rootDir>../coverage/modeling-ce/app-shell',
collectCoverageFrom: [
'<rootDir>/src/**/*.ts',
Expand All @@ -14,8 +13,8 @@ module.exports = getJestConfig({
path.resolve(__dirname, 'src')
],
globals: {
"ts-jest": {
tsconfig: "<rootDir>/tsconfig.spec.json"
"ts-jest": {
tsconfig: path.resolve(__dirname, 'tsconfig.spec.json'),
}
}
}, 'tsconfig.json', path.resolve(__dirname, '../..'));
5 changes: 2 additions & 3 deletions projects/connector-editor/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const path = require('path');
const getJestConfig = require(__dirname + '/../adf-candidates/testing/jest/jest.get-config');

module.exports = getJestConfig({
rootDir: path.resolve(__dirname),
coverageDirectory: '<rootDir>/../../../../coverage/modeling-ce/connector-editor',
collectCoverageFrom: [
'<rootDir>/src/**/*.ts',
Expand All @@ -14,8 +13,8 @@ module.exports = getJestConfig({
path.resolve(__dirname, 'src')
],
globals: {
"ts-jest": {
tsconfig: "<rootDir>/tsconfig.spec.json"
"ts-jest": {
tsconfig: path.resolve(__dirname, 'tsconfig.spec.json'),
}
}
}, 'tsconfig.json', path.resolve(__dirname, '../..'));
5 changes: 2 additions & 3 deletions projects/dashboard/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const path = require('path');
const getJestConfig = require(__dirname + '/../adf-candidates/testing/jest/jest.get-config');

module.exports = getJestConfig({
rootDir: path.resolve(__dirname),
coverageDirectory: '<rootDir>/../../../../coverage/modeling-ce/dashboard',
collectCoverageFrom: [
'<rootDir>/src/**/*.ts',
Expand All @@ -14,8 +13,8 @@ module.exports = getJestConfig({
path.resolve(__dirname, 'src')
],
globals: {
"ts-jest": {
tsconfig: "<rootDir>/tsconfig.spec.json"
"ts-jest": {
tsconfig: path.resolve(__dirname, 'tsconfig.spec.json'),
}
}
}, 'tsconfig.json', path.resolve(__dirname, '../..'));
3 changes: 1 addition & 2 deletions projects/modeling-shared/sdk/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const path = require('path');
const getJestConfig = require(__dirname + '/../../adf-candidates/testing/jest/jest.get-config');

module.exports = getJestConfig({
rootDir: path.resolve(__dirname),
coverageDirectory: '<rootDir>/../../../../../coverage/modeling-ce/modeling-sdk',
collectCoverageFrom: [
'<rootDir>/src/**/*.ts',
Expand All @@ -15,7 +14,7 @@ module.exports = getJestConfig({
],
globals: {
"ts-jest": {
tsconfig: "<rootDir>/tsconfig.spec.json"
tsconfig: path.resolve(__dirname, 'tsconfig.spec.json'),
}
}
}, 'tsconfig.json', path.resolve(__dirname, '../../..'));
Loading

0 comments on commit 3ce43c6

Please sign in to comment.