@genesislcap/blank-app-seed 3.30.0-prerelease.13 → 3.30.0-prerelease.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed-config",
3
3
  "description": "Genesis Blank App Seed Configuration",
4
- "version": "3.30.0-prerelease.13",
4
+ "version": "3.30.0-prerelease.14",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "lint": "eslint .",
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.30.0-prerelease.14](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.30.0-prerelease.13...v3.30.0-prerelease.14) (2024-09-26)
4
+
5
+
6
+ ### Features
7
+
8
+ * replaced karma with jest in angular (#348) 805d7ec
9
+
3
10
  ## [3.30.0-prerelease.13](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.30.0-prerelease.12...v3.30.0-prerelease.13) (2024-09-18)
4
11
 
5
12
 
@@ -0,0 +1 @@
1
+ module.exports = 'test-file-stub';
@@ -90,35 +90,6 @@
90
90
  "buildTarget": "{{pkgName}}:build"
91
91
  }
92
92
  },
93
- "test": {
94
- "builder": "@angular-builders/custom-webpack:karma",
95
- "configurations": {
96
- "production": {
97
- "customWebpackConfig": {
98
- "path": "./webpack.prod.config.js",
99
- "mergeStrategies": {
100
- "externals": "replace"
101
- }
102
- }
103
- },
104
- "development": {
105
- "customWebpackConfig": {
106
- "path": "./webpack.dev.config.js",
107
- "mergeStrategies": {
108
- "externals": "replace"
109
- }
110
- }
111
- }
112
- },
113
- "defaultConfiguration": "development",
114
- "options": {
115
- "polyfills": ["zone.js", "zone.js/testing"],
116
- "tsConfig": "tsconfig.spec.json",
117
- "assets": ["src/favicon.ico", "src/assets"],
118
- "styles": ["src/styles/styles.css"],
119
- "scripts": []
120
- }
121
- },
122
93
  "lint": {
123
94
  "builder": "@angular-eslint/builder:lint",
124
95
  "options": {
@@ -0,0 +1,20 @@
1
+ const { pathsToModuleNameMapper } = require('ts-jest');
2
+ const { compilerOptions } = require('./tsconfig');
3
+
4
+ module.exports = {
5
+ preset: 'jest-preset-angular',
6
+ roots: ['<rootDir>/src/'],
7
+ testMatch: ['**/+(*.)+(spec).+(ts)'],
8
+ setupFilesAfterEnv: ['<rootDir>/src/jest.setup.ts'],
9
+ collectCoverage: true,
10
+ coverageReporters: ['html'],
11
+ coverageDirectory: 'coverage/my-app',
12
+ transformIgnorePatterns: [
13
+ 'node_modules/(?!(@genesislcap/*|consola|@angular|@microsoft|exenv-es6|uuid))',
14
+ ],
15
+ moduleNameMapper: {
16
+ ...pathsToModuleNameMapper(compilerOptions.paths || {}, { prefix: '<rootDir>/' }),
17
+ '\\.(jpg|jpeg|png|gif|svg)$': '<rootDir>/src/__mocks__/fileMock.js',
18
+ '\\.(css)$': 'identity-obj-proxy',
19
+ },
20
+ };
@@ -27,7 +27,7 @@
27
27
  "lint:fix": "genx lint --fix",
28
28
  "lint:eslint": "genx lint -l eslint --profile",
29
29
  "lint:stylelint": "node lint-css.js",
30
- "test": "ng test",
30
+ "test": "jest",
31
31
  "test:e2e": "genx test --e2e",
32
32
  "test:e2e:debug": "genx test --e2e --debug",
33
33
  "test:e2e:ui": "genx test --e2e --interactive",
@@ -54,14 +54,14 @@
54
54
  "@genesislcap/genx": "{{versions.UI}}",
55
55
  "@genesislcap/build-kit": "{{versions.UI}}",
56
56
  "@types/jasmine": "~5.1.0",
57
+ "@types/jest": "^29.5.13",
57
58
  "@types/numeral": "^2.0.5",
58
59
  "file-loader": "^6.2.0",
59
60
  "jasmine-core": "~5.1.0",
60
- "karma": "~6.4.0",
61
- "karma-chrome-launcher": "~3.2.0",
62
- "karma-coverage": "~2.2.0",
63
- "karma-jasmine": "~5.1.0",
64
- "karma-jasmine-html-reporter": "~2.1.0",
61
+ "jest": "^29.7.0",
62
+ "jest-environment-jsdom": "^29.7.0",
63
+ "jest-preset-angular": "^14.2.4",
64
+ "jest-transform-stub": "^2.0.0",
65
65
  "svg-url-loader": "^8.0.0",
66
66
  "typescript": "~5.4.5",
67
67
  "ts-node": "10.9.2",
@@ -4,7 +4,7 @@ import { DefaultLayoutComponent } from './default.layout';
4
4
  import { ElementRef, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
5
5
 
6
6
  class MockRouter {
7
- navigate = jasmine.createSpy('navigate');
7
+ navigate = jest.fn();
8
8
  }
9
9
 
10
10
  class MockElementRef implements ElementRef {
@@ -46,4 +46,4 @@ describe('DefaultLayoutComponent', () => {
46
46
  component.navigateAngular(path);
47
47
  expect(router.navigate).toHaveBeenCalledWith([path]);
48
48
  });
49
- });
49
+ });
@@ -0,0 +1,46 @@
1
+ import 'jest-preset-angular/setup-jest';
2
+
3
+ // Mock window.matchMedia
4
+ Object.defineProperty(window, 'matchMedia', {
5
+ writable: true,
6
+ value: (query: string) => ({
7
+ matches: false,
8
+ media: query,
9
+ onchange: null,
10
+ addListener: jest.fn(), // Deprecated
11
+ removeListener: jest.fn(), // Deprecated
12
+ addEventListener: jest.fn(),
13
+ removeEventListener: jest.fn(),
14
+ dispatchEvent: jest.fn(),
15
+ }),
16
+ });
17
+
18
+ // Mock BroadcastChannel
19
+ class MockBroadcastChannel {
20
+ name: string;
21
+ onmessage: ((this: BroadcastChannel, ev: MessageEvent) => any) | null = null;
22
+ onmessageerror: ((this: BroadcastChannel, ev: MessageEvent) => any) | null = null;
23
+
24
+ constructor(name: string) {
25
+ this.name = name;
26
+ }
27
+
28
+ postMessage(message: any) {
29
+ if (this.onmessage) {
30
+ this.onmessage({ data: message } as MessageEvent);
31
+ }
32
+ }
33
+
34
+ close() {}
35
+
36
+ addEventListener() {}
37
+ removeEventListener() {}
38
+ dispatchEvent() {
39
+ return false;
40
+ }
41
+ }
42
+
43
+ Object.defineProperty(window, 'BroadcastChannel', {
44
+ writable: true,
45
+ value: MockBroadcastChannel,
46
+ });
@@ -1,9 +1,8 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
1
  {
3
2
  "extends": "./tsconfig.json",
4
3
  "compilerOptions": {
5
4
  "outDir": "./out-tsc/app",
6
- "types": ["node"],
5
+ "types": ["node"]
7
6
  },
8
7
  "files": [
9
8
  "src/main.ts"
@@ -1,4 +1,3 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
1
  {
3
2
  "compileOnSave": false,
4
3
  "compilerOptions": {
@@ -23,7 +22,7 @@
23
22
  "ES2022",
24
23
  "dom"
25
24
  ],
26
- "resolveJsonModule": true,
25
+ "resolveJsonModule": true
27
26
  },
28
27
  "angularCompilerOptions": {
29
28
  "enableI18nLegacyMessageIdFormat": false,
@@ -1,15 +1,21 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
1
  {
3
2
  "extends": "./tsconfig.json",
4
3
  "compilerOptions": {
4
+ "module": "ES2022",
5
+ "target": "ES2022",
5
6
  "outDir": "./out-tsc/spec",
6
7
  "types": [
7
- "jasmine"
8
- ]
8
+ "jest"
9
+ ],
10
+ "esModuleInterop": true,
11
+ "emitDecoratorMetadata": true,
12
+ "resolveJsonModule": true
9
13
  },
14
+ "files": [
15
+ "src/jest.setup.ts",
16
+ ],
10
17
  "include": [
11
- "src/**/*.d.ts",
12
- "src/pbc/**/*.ts",
13
- "src/**/*.spec.ts"
18
+ "src/**/*.spec.ts",
19
+ "src/**/*.d.ts"
14
20
  ]
15
- }
21
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed",
3
3
  "description": "Genesis Blank App Seed",
4
- "version": "3.30.0-prerelease.13",
4
+ "version": "3.30.0-prerelease.14",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "release": "semantic-release"
@@ -1,9 +0,0 @@
1
- module.exports = function(config) {
2
- config.set({
3
- browsers: ['Chrome'],
4
- browserDisconnectTimeout: 60000,
5
- browserDisconnectTolerance: 3,
6
- browserNoActivityTimeout: 60000,
7
- captureTimeout: 120000,
8
- });
9
- };
@@ -1,23 +0,0 @@
1
- import { TestBed } from '@angular/core/testing';
2
- import { AppComponent } from './app.component';
3
-
4
- describe('AppComponent', () => {
5
- beforeEach(async () => {
6
- await TestBed.configureTestingModule({
7
- declarations: [AppComponent],
8
- }).compileComponents();
9
- });
10
-
11
- it('should create the app', () => {
12
- const fixture = TestBed.createComponent(AppComponent);
13
- const app = fixture.componentInstance;
14
- expect(app).toBeTruthy();
15
- });
16
-
17
- it(`should have the '{{capitalCase appName}}' title`, () => {
18
- const fixture = TestBed.createComponent(AppComponent);
19
- const app = fixture.componentInstance;
20
- expect(app.title).toEqual('{{capitalCase appName}}');
21
- });
22
- });
23
-