From 218b217c02d053ab98f476f26f716e95d407ac5c Mon Sep 17 00:00:00 2001 From: Ahn Date: Tue, 23 Mar 2021 17:01:52 +0100 Subject: [PATCH] fix: define export path for `jest-preset` (#896) --- e2e/test-app-v10/jest-cjs-iso.config.js | 4 ++-- e2e/test-app-v10/jest-esm-iso.config.js | 5 ++--- e2e/test-app-v11/jest-cjs-iso.config.js | 4 ++-- e2e/test-app-v11/jest-esm-iso.config.js | 5 ++--- e2e/test-app-v9/jest-cjs-iso.config.js | 4 ++-- e2e/test-app-v9/jest-esm-iso.config.js | 5 ++--- package.json | 3 ++- 7 files changed, 14 insertions(+), 16 deletions(-) diff --git a/e2e/test-app-v10/jest-cjs-iso.config.js b/e2e/test-app-v10/jest-cjs-iso.config.js index feaaef5280..50e1dc1073 100644 --- a/e2e/test-app-v10/jest-cjs-iso.config.js +++ b/e2e/test-app-v10/jest-cjs-iso.config.js @@ -1,4 +1,5 @@ const baseConfig = require('./jest.config'); +const defaultPreset = require('jest-preset-angular/jest-preset'); /** @type {import('ts-jest/dist/types').ProjectConfigTsJest} */ module.exports = { @@ -6,8 +7,7 @@ module.exports = { preset: 'jest-preset-angular', globals: { 'ts-jest': { - tsconfig: '/tsconfig-cjs.spec.json', - stringifyContentPathRegex: '\\.html$', + ...defaultPreset.globals['ts-jest'], isolatedModules: true, } }, diff --git a/e2e/test-app-v10/jest-esm-iso.config.js b/e2e/test-app-v10/jest-esm-iso.config.js index ca4ef72bf8..d772a41c91 100644 --- a/e2e/test-app-v10/jest-esm-iso.config.js +++ b/e2e/test-app-v10/jest-esm-iso.config.js @@ -1,4 +1,5 @@ const baseConfig = require('./jest.config'); +const basePreset = require('jest-preset-angular/presets'); /** @type {import('ts-jest/dist/types').ProjectConfigTsJest} */ module.exports = { @@ -6,9 +7,7 @@ module.exports = { preset: 'jest-preset-angular/presets/defaults-esm', globals: { 'ts-jest': { - tsconfig: '/tsconfig-esm.spec.json', - stringifyContentPathRegex: '\\.html$', - useESM: true, + ...basePreset.defaultsESM.globals['ts-jest'], isolatedModules: true, } }, diff --git a/e2e/test-app-v11/jest-cjs-iso.config.js b/e2e/test-app-v11/jest-cjs-iso.config.js index feaaef5280..50e1dc1073 100644 --- a/e2e/test-app-v11/jest-cjs-iso.config.js +++ b/e2e/test-app-v11/jest-cjs-iso.config.js @@ -1,4 +1,5 @@ const baseConfig = require('./jest.config'); +const defaultPreset = require('jest-preset-angular/jest-preset'); /** @type {import('ts-jest/dist/types').ProjectConfigTsJest} */ module.exports = { @@ -6,8 +7,7 @@ module.exports = { preset: 'jest-preset-angular', globals: { 'ts-jest': { - tsconfig: '/tsconfig-cjs.spec.json', - stringifyContentPathRegex: '\\.html$', + ...defaultPreset.globals['ts-jest'], isolatedModules: true, } }, diff --git a/e2e/test-app-v11/jest-esm-iso.config.js b/e2e/test-app-v11/jest-esm-iso.config.js index ca4ef72bf8..d772a41c91 100644 --- a/e2e/test-app-v11/jest-esm-iso.config.js +++ b/e2e/test-app-v11/jest-esm-iso.config.js @@ -1,4 +1,5 @@ const baseConfig = require('./jest.config'); +const basePreset = require('jest-preset-angular/presets'); /** @type {import('ts-jest/dist/types').ProjectConfigTsJest} */ module.exports = { @@ -6,9 +7,7 @@ module.exports = { preset: 'jest-preset-angular/presets/defaults-esm', globals: { 'ts-jest': { - tsconfig: '/tsconfig-esm.spec.json', - stringifyContentPathRegex: '\\.html$', - useESM: true, + ...basePreset.defaultsESM.globals['ts-jest'], isolatedModules: true, } }, diff --git a/e2e/test-app-v9/jest-cjs-iso.config.js b/e2e/test-app-v9/jest-cjs-iso.config.js index feaaef5280..50e1dc1073 100644 --- a/e2e/test-app-v9/jest-cjs-iso.config.js +++ b/e2e/test-app-v9/jest-cjs-iso.config.js @@ -1,4 +1,5 @@ const baseConfig = require('./jest.config'); +const defaultPreset = require('jest-preset-angular/jest-preset'); /** @type {import('ts-jest/dist/types').ProjectConfigTsJest} */ module.exports = { @@ -6,8 +7,7 @@ module.exports = { preset: 'jest-preset-angular', globals: { 'ts-jest': { - tsconfig: '/tsconfig-cjs.spec.json', - stringifyContentPathRegex: '\\.html$', + ...defaultPreset.globals['ts-jest'], isolatedModules: true, } }, diff --git a/e2e/test-app-v9/jest-esm-iso.config.js b/e2e/test-app-v9/jest-esm-iso.config.js index ca4ef72bf8..d772a41c91 100644 --- a/e2e/test-app-v9/jest-esm-iso.config.js +++ b/e2e/test-app-v9/jest-esm-iso.config.js @@ -1,4 +1,5 @@ const baseConfig = require('./jest.config'); +const basePreset = require('jest-preset-angular/presets'); /** @type {import('ts-jest/dist/types').ProjectConfigTsJest} */ module.exports = { @@ -6,9 +7,7 @@ module.exports = { preset: 'jest-preset-angular/presets/defaults-esm', globals: { 'ts-jest': { - tsconfig: '/tsconfig-esm.spec.json', - stringifyContentPathRegex: '\\.html$', - useESM: true, + ...basePreset.defaultsESM.globals['ts-jest'], isolatedModules: true, } }, diff --git a/package.json b/package.json index 929119fae5..fbf77f6c4e 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "main": "build/index.js", "exports": { ".": "./dist/index.js", - "./presets": "./jest-preset.js", + "./presets": "./presets/index.js", + "./jest-preset": "./jest-preset.js", "./setup-jest": "./setup-jest.js", "./ngcc-jest-processor": "./ngcc-jest-processor.js", "./package.json": "./package.json"