Skip to content

Commit

Permalink
test: switch example app test config files to ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnpnl committed Oct 3, 2024
1 parent 1264935 commit e61f1ff
Show file tree
Hide file tree
Showing 75 changed files with 506 additions and 525 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { JestConfigWithTsJest } from 'ts-jest';

import jestCfg from './jest-esm.config';

export default {
...jestCfg,
transform: {
'^.+\\.(ts|js|html|svg)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig-esm.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
isolatedModules: true,
useESM: true,
},
],
},
} satisfies JestConfigWithTsJest;
27 changes: 0 additions & 27 deletions examples/example-app-monorepo/apps/app1/jest-esm.config.mjs

This file was deleted.

25 changes: 25 additions & 0 deletions examples/example-app-monorepo/apps/app1/jest-esm.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import ngPreset from 'jest-preset-angular/presets';
import { pathsToModuleNameMapper, type JestConfigWithTsJest } from 'ts-jest';

import tsconfig from './tsconfig.json';

export default {
...ngPreset.defaultsESM,
displayName: 'app1',
moduleNameMapper: {
...pathsToModuleNameMapper(tsconfig.compilerOptions.paths, { prefix: '<rootDir>' }),
tslib: 'tslib/tslib.es6.js',
rxjs: '<rootDir>/../../node_modules/rxjs/dist/bundles/rxjs.umd.js',
},
setupFilesAfterEnv: ['<rootDir>/setup-jest-esm.ts'],
transform: {
'^.+\\.(ts|js|html|svg)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig-esm.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
useESM: true,
},
],
},
} satisfies JestConfigWithTsJest;
17 changes: 0 additions & 17 deletions examples/example-app-monorepo/apps/app1/jest-isolated.config.js

This file was deleted.

17 changes: 17 additions & 0 deletions examples/example-app-monorepo/apps/app1/jest-isolated.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import presets from 'jest-preset-angular/presets';
import type { JestConfigWithTsJest } from 'ts-jest';

import jestCfg from './jest.config';

export default {
...jestCfg,
transform: {
'^.+\\.(ts|js|mjs|html|svg)$': [
'jest-preset-angular',
{
...presets.defaultTransformerOptions,
isolatedModules: true,
},
],
},
} satisfies JestConfigWithTsJest;
11 changes: 0 additions & 11 deletions examples/example-app-monorepo/apps/app1/jest.config.js

This file was deleted.

10 changes: 10 additions & 0 deletions examples/example-app-monorepo/apps/app1/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { pathsToModuleNameMapper, type JestConfigWithTsJest } from 'ts-jest';

import { compilerOptions } from './tsconfig.json';

export default {
displayName: 'app1',
preset: 'jest-preset-angular',
setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),
} satisfies JestConfigWithTsJest;
2 changes: 1 addition & 1 deletion examples/example-app-monorepo/apps/app1/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig-base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": "./",
"paths": {
Expand Down
6 changes: 0 additions & 6 deletions examples/example-app-monorepo/jest-esm-isolated.config.mjs

This file was deleted.

5 changes: 5 additions & 0 deletions examples/example-app-monorepo/jest-esm-isolated.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { JestConfigWithTsJest } from 'ts-jest';

export default {
projects: ['<rootDir>/apps/app1/jest-esm-isolated.config.ts', '<rootDir>/libs/user/jest-esm-isolated.config.ts'],
} satisfies JestConfigWithTsJest;
6 changes: 0 additions & 6 deletions examples/example-app-monorepo/jest-esm.config.mjs

This file was deleted.

5 changes: 5 additions & 0 deletions examples/example-app-monorepo/jest-esm.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { JestConfigWithTsJest } from 'ts-jest';

export default {
projects: ['<rootDir>/apps/app1/jest-esm.config.ts', '<rootDir>/libs/user/jest-esm.config.ts'],
} satisfies JestConfigWithTsJest;
4 changes: 0 additions & 4 deletions examples/example-app-monorepo/jest-isolated.config.js

This file was deleted.

5 changes: 5 additions & 0 deletions examples/example-app-monorepo/jest-isolated.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { JestConfigWithTsJest } from 'ts-jest';

export default {
projects: ['<rootDir>/apps/app1/jest-isolated.config.ts', '<rootDir>/libs/user/jest-isolated.config.ts'],
} satisfies JestConfigWithTsJest;
4 changes: 0 additions & 4 deletions examples/example-app-monorepo/jest.config.js

This file was deleted.

5 changes: 5 additions & 0 deletions examples/example-app-monorepo/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { JestConfigWithTsJest } from 'ts-jest';

export default {
projects: ['<rootDir>/apps/app1', '<rootDir>/libs/user'],
} satisfies JestConfigWithTsJest;

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { JestConfigWithTsJest } from 'ts-jest';

import jestCfg from './jest-esm.config';

export default {
...jestCfg,
transform: {
'^.+\\.(ts|js|html|svg)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig-esm.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
isolatedModules: true,
useESM: true,
},
],
},
} satisfies JestConfigWithTsJest;
24 changes: 0 additions & 24 deletions examples/example-app-monorepo/libs/user/jest-esm.config.mjs

This file was deleted.

22 changes: 22 additions & 0 deletions examples/example-app-monorepo/libs/user/jest-esm.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import ngPreset from 'jest-preset-angular/presets';
import type { JestConfigWithTsJest } from 'ts-jest';

export default {
...ngPreset.defaultsESM,
displayName: 'user-lib',
moduleNameMapper: {
tslib: 'tslib/tslib.es6.js',
rxjs: '<rootDir>/../../node_modules/rxjs/dist/bundles/rxjs.umd.js',
},
setupFilesAfterEnv: ['<rootDir>/setup-jest-esm.ts'],
transform: {
'^.+\\.(ts|js|html|svg)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig-esm.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
useESM: true,
},
],
},
} satisfies JestConfigWithTsJest;
17 changes: 17 additions & 0 deletions examples/example-app-monorepo/libs/user/jest-isolated.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import presets from 'jest-preset-angular/presets';
import type { JestConfigWithTsJest } from 'ts-jest';

import jestCfg from './jest.config';

export default {
...jestCfg,
transform: {
'^.+\\.(ts|js|mjs|html|svg)$': [
'jest-preset-angular',
{
...presets.defaultTransformerOptions,
isolatedModules: true,
},
],
},
} satisfies JestConfigWithTsJest;
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
module.exports = {
import type { JestConfigWithTsJest } from 'ts-jest';

export default {
displayName: 'user-lib',
preset: 'jest-preset-angular',
setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
};
} satisfies JestConfigWithTsJest;
2 changes: 1 addition & 1 deletion examples/example-app-monorepo/libs/user/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../tsconfig-base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"declaration": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/example-app-monorepo/libs/user/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../tsconfig-base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"types": [
Expand Down
6 changes: 3 additions & 3 deletions examples/example-app-monorepo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"start": "ng serve",
"build": "ng build",
"test": "jest --no-cache",
"test-isolated": "jest -c=jest-isolated.config.js --no-cache",
"test-esm": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest-esm.config.mjs --no-cache",
"test-esm-isolated": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest-esm-isolated.config.mjs --no-cache"
"test-isolated": "jest -c=jest-isolated.config.ts --no-cache",
"test-esm": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest-esm.config.ts --no-cache",
"test-esm-isolated": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest-esm-isolated.config.ts --no-cache"
},
"private": true,
"dependencies": {
Expand Down
File renamed without changes.
19 changes: 0 additions & 19 deletions examples/example-app-v16/jest-esm-isolated.config.mjs

This file was deleted.

18 changes: 18 additions & 0 deletions examples/example-app-v16/jest-esm-isolated.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { JestConfigWithTsJest } from 'ts-jest';

import jestCfg from './jest-esm.config';

export default {
...jestCfg,
transform: {
'^.+\\.(ts|js|html|svg)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig-esm.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
isolatedModules: true,
useESM: true,
},
],
},
} satisfies JestConfigWithTsJest;
Loading

0 comments on commit e61f1ff

Please sign in to comment.