Skip to content

Commit

Permalink
test(examples): add isolatedModules: true test config (#1167)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnpnl authored Nov 13, 2021
1 parent 9eddb70 commit 3458936
Show file tree
Hide file tree
Showing 41 changed files with 272 additions and 38 deletions.
14 changes: 14 additions & 0 deletions examples/example-app-v10/jest-esm-isolated.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const jestCfg = require('./jest-esm.config');

/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
...jestCfg,
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig-esm.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
isolatedModules: true,
useESM: true,
},
},
};
2 changes: 1 addition & 1 deletion examples/example-app-v10/jest-esm.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require('jest-preset-angular/ngcc-jest-processor');
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { paths } = require('./tsconfig.json').compilerOptions;

/** @type {import('@jest/types').Config.InitialOptions} */
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'jest-preset-angular/presets/defaults-esm',
globals: {
Expand Down
13 changes: 13 additions & 0 deletions examples/example-app-v10/jest-isolated.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const jestCfg = require('./jest.config');

/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
...jestCfg,
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
isolatedModules: true,
},
},
};
2 changes: 1 addition & 1 deletion examples/example-app-v10/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require('jest-preset-angular/ngcc-jest-processor');
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { paths } = require('./tsconfig.json').compilerOptions;

/** @type {import('@jest/types').Config.InitialOptions} */
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'jest-preset-angular',
moduleNameMapper: pathsToModuleNameMapper(paths, { prefix: '<rootDir>' }),
Expand Down
8 changes: 5 additions & 3 deletions examples/example-app-v10/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "jest",
"test-esm": "node --experimental-vm-modules node_modules/jest/bin/jest.js -c=jest-esm.config.js"
"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.js --no-cache",
"test-esm-isolated": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest-esm-isolated.config.js --no-cache"
},
"private": true,
"dependencies": {
Expand All @@ -32,4 +34,4 @@
"jest-preset-angular": "^10.1.0",
"typescript": "~4.0.7"
}
}
}
14 changes: 14 additions & 0 deletions examples/example-app-v11/jest-esm-isolated.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const jestCfg = require('./jest-esm.config');

/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
...jestCfg,
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig-esm.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
isolatedModules: true,
useESM: true,
},
},
};
2 changes: 1 addition & 1 deletion examples/example-app-v11/jest-esm.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require('jest-preset-angular/ngcc-jest-processor');
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { paths } = require('./tsconfig.json').compilerOptions;

/** @type {import('@jest/types').Config.InitialOptions} */
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'jest-preset-angular/presets/defaults-esm',
globals: {
Expand Down
13 changes: 13 additions & 0 deletions examples/example-app-v11/jest-isolated.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const jestCfg = require('./jest.config');

/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
...jestCfg,
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
isolatedModules: true,
},
},
};
2 changes: 1 addition & 1 deletion examples/example-app-v11/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require('jest-preset-angular/ngcc-jest-processor');
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { paths } = require('./tsconfig.json').compilerOptions;

/** @type {import('@jest/types').Config.InitialOptions} */
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'jest-preset-angular',
moduleNameMapper: pathsToModuleNameMapper(paths, { prefix: '<rootDir>' }),
Expand Down
8 changes: 5 additions & 3 deletions examples/example-app-v11/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "jest",
"test-esm": "node --experimental-vm-modules node_modules/jest/bin/jest.js -c=jest-esm.config.js"
"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.js --no-cache",
"test-esm-isolated": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest-esm-isolated.config.js --no-cache"
},
"private": true,
"dependencies": {
Expand All @@ -32,4 +34,4 @@
"jest-preset-angular": "^10.1.0",
"typescript": "~4.1.5"
}
}
}
7 changes: 7 additions & 0 deletions examples/example-app-v12-monorepo/jest-esm-isolated.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
projects: [
'<rootDir>/projects/app1/jest-esm-isolated.config.js',
'<rootDir>/projects/app2/jest-esm-isolated.config.js',
],
};
2 changes: 1 addition & 1 deletion examples/example-app-v12-monorepo/jest-esm.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @type {import('@jest/types').Config.InitialOptions} */
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
projects: ['<rootDir>/projects/app1/jest-esm.config.js', '<rootDir>/projects/app2/jest-esm.config.js'],
};
4 changes: 4 additions & 0 deletions examples/example-app-v12-monorepo/jest-isolated.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
projects: ['<rootDir>/projects/app1/jest-isolated.config.js', '<rootDir>/projects/app2/jest-isolated.config.js'],
};
2 changes: 1 addition & 1 deletion examples/example-app-v12-monorepo/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @type {import('@jest/types').Config.InitialOptions} */
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
projects: ['<rootDir>/projects/app1', '<rootDir>/projects/app2'],
};
8 changes: 5 additions & 3 deletions examples/example-app-v12-monorepo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "jest",
"test-esm": "node --experimental-vm-modules node_modules/jest/bin/jest.js -c=jest-esm.config.js"
"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.js --no-cache",
"test-esm-isolated": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest-esm-isolated.config.js --no-cache"
},
"private": true,
"dependencies": {
Expand All @@ -32,4 +34,4 @@
"jest-preset-angular": "^10.1.0",
"typescript": "~4.2.3"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const jestCfg = require('./jest-esm.config');

/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
...jestCfg,
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig-esm.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
isolatedModules: true,
useESM: true,
},
},
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require('jest-preset-angular/ngcc-jest-processor');

/** @type {import('@jest/types').Config.InitialOptions} */
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'jest-preset-angular/presets/defaults-esm',
globals: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const jestCfg = require('./jest.config');

/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
...jestCfg,
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
isolatedModules: true,
},
},
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require('jest-preset-angular/ngcc-jest-processor');

/** @type {import('@jest/types').Config.InitialOptions} */
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'jest-preset-angular',
moduleNameMapper: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const jestCfg = require('./jest-esm.config');

/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
...jestCfg,
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig-esm.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
isolatedModules: true,
useESM: true,
},
},
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require('jest-preset-angular/ngcc-jest-processor');

/** @type {import('@jest/types').Config.InitialOptions} */
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'jest-preset-angular/presets/defaults-esm',
globals: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const jestCfg = require('./jest.config');

/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
...jestCfg,
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
isolatedModules: true,
},
},
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require('jest-preset-angular/ngcc-jest-processor');

/** @type {import('@jest/types').Config.InitialOptions} */
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'jest-preset-angular',
moduleNameMapper: {
Expand Down
14 changes: 14 additions & 0 deletions examples/example-app-v12/jest-esm-isolated.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const jestCfg = require('./jest-esm.config');

/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
...jestCfg,
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig-esm.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
isolatedModules: true,
useESM: true,
},
},
};
2 changes: 1 addition & 1 deletion examples/example-app-v12/jest-esm.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require('jest-preset-angular/ngcc-jest-processor');
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { paths } = require('./tsconfig.json').compilerOptions;

/** @type {import('@jest/types').Config.InitialOptions} */
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'jest-preset-angular/presets/defaults-esm',
globals: {
Expand Down
13 changes: 13 additions & 0 deletions examples/example-app-v12/jest-isolated.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const jestCfg = require('./jest.config');

/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
...jestCfg,
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
isolatedModules: true,
},
},
};
2 changes: 1 addition & 1 deletion examples/example-app-v12/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require('jest-preset-angular/ngcc-jest-processor');
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { paths } = require('./tsconfig.json').compilerOptions;

/** @type {import('@jest/types').Config.InitialOptions} */
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'jest-preset-angular',
moduleNameMapper: pathsToModuleNameMapper(paths, { prefix: '<rootDir>' }),
Expand Down
8 changes: 5 additions & 3 deletions examples/example-app-v12/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "jest",
"test-esm": "node --experimental-vm-modules node_modules/jest/bin/jest.js -c=jest-esm.config.js"
"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.js --no-cache",
"test-esm-isolated": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest-esm-isolated.config.js --no-cache"
},
"private": true,
"dependencies": {
Expand All @@ -32,4 +34,4 @@
"jest-preset-angular": "^10.1.0",
"typescript": "~4.2.4"
}
}
}
14 changes: 14 additions & 0 deletions examples/example-app-v13/jest-esm-isolated.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const jestCfg = require('./jest-esm.config');

/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
...jestCfg,
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig-esm.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
isolatedModules: true,
useESM: true,
},
},
};
2 changes: 1 addition & 1 deletion examples/example-app-v13/jest-esm.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require('jest-preset-angular/ngcc-jest-processor');
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { paths } = require('./tsconfig.json').compilerOptions;

/** @type {import('@jest/types').Config.InitialOptions} */
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'jest-preset-angular/presets/defaults-esm',
globals: {
Expand Down
13 changes: 13 additions & 0 deletions examples/example-app-v13/jest-isolated.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const jestCfg = require('./jest.config');

/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
...jestCfg,
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
isolatedModules: true,
},
},
};
2 changes: 1 addition & 1 deletion examples/example-app-v13/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require('jest-preset-angular/ngcc-jest-processor');
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { paths } = require('./tsconfig.json').compilerOptions;

/** @type {import('@jest/types').Config.InitialOptions} */
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'jest-preset-angular',
moduleNameMapper: pathsToModuleNameMapper(paths, { prefix: '<rootDir>' }),
Expand Down
6 changes: 4 additions & 2 deletions examples/example-app-v13/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "jest",
"test-esm": "node --experimental-vm-modules node_modules/jest/bin/jest.js -c=jest-esm.config.js"
"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.js --no-cache",
"test-esm-isolated": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest-esm-isolated.config.js --no-cache"
},
"private": true,
"dependencies": {
Expand Down
Loading

0 comments on commit 3458936

Please sign in to comment.