Skip to content

Commit

Permalink
refactor(presets): improve transformIgnorePatterns value (#1162)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnpnl authored Nov 9, 2021
1 parent 7971342 commit 99a4b1b
Show file tree
Hide file tree
Showing 30 changed files with 353 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ e2e/**/.yarn/*
!e2e/**/.yarn/releases
!e2e/**/.yarn/sdks
!e2e/**/.yarn/versions
!/e2e/ng-lib-import/node_modules
src/transformers/downlevel_decorators_transform
src/ngtsc
15 changes: 15 additions & 0 deletions e2e/__tests__/ng-lib-import.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { json as runWithJson } from '../run-jest';

const DIR = 'ng-lib-import';

test(`successfully runs the tests inside ${DIR} with isolatedModules: false`, () => {
const { json } = runWithJson(DIR);

expect(json.success).toBe(true);
});

test(`successfully runs the tests inside ${DIR} with isolatedModules: true`, () => {
const { json } = runWithJson(DIR, ['-c=jest-isolated.config.js']);

expect(json.success).toBe(true);
});
2 changes: 1 addition & 1 deletion e2e/ast-transformers/ng-jit-transformers/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ module.exports = {
transform: {
'^.+\\.(ts|js|mjs|html)$': '<rootDir>/../../../build/index.js',
},
transformIgnorePatterns: ['node_modules/(?!@angular)'],
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
};
2 changes: 1 addition & 1 deletion e2e/async/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ module.exports = {
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['<rootDir>/../../setup-jest.js'],
transform: { '^.+\\.(ts|mjs|js|html)$': '<rootDir>/../../build/index.js' },
transformIgnorePatterns: ['node_modules/(?!@angular)'],
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
};
2 changes: 1 addition & 1 deletion e2e/ng-deep-import/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ module.exports = {
transform: {
'^.+\\.(ts|js|mjs|html)$': '<rootDir>/../../build/index.js',
},
transformIgnorePatterns: ['node_modules/(?!@angular)'],
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
};
5 changes: 5 additions & 0 deletions e2e/ng-lib-import/__tests__/ng-lib-import.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { MyLibService } from 'my-lib';

test('should pass', () => {
expect(new MyLibService()).toBeInstanceOf(MyLibService);
});
10 changes: 10 additions & 0 deletions e2e/ng-lib-import/jest-isolated.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const baseCfg = require('./jest.config');

module.exports = {
...baseCfg,
globals: {
'ts-jest': {
isolatedModules: true,
},
},
};
10 changes: 10 additions & 0 deletions e2e/ng-lib-import/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'],
resolver: '<rootDir>/../../build/resolvers/ng-jest-resolver.js',
setupFilesAfterEnv: ['<rootDir>/../../setup-jest.js'],
testEnvironment: 'jsdom',
transform: {
'^.+\\.(ts|js|mjs|html)$': '<rootDir>/../../build/index.js',
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
};
24 changes: 24 additions & 0 deletions e2e/ng-lib-import/node_modules/my-lib/README.md

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

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

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

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

5 changes: 5 additions & 0 deletions e2e/ng-lib-import/node_modules/my-lib/esm2020/my-lib.mjs

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

7 changes: 7 additions & 0 deletions e2e/ng-lib-import/node_modules/my-lib/esm2020/public-api.mjs

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

66 changes: 66 additions & 0 deletions e2e/ng-lib-import/node_modules/my-lib/fesm2015/my-lib.mjs

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

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

66 changes: 66 additions & 0 deletions e2e/ng-lib-import/node_modules/my-lib/fesm2020/my-lib.mjs

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

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

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

7 changes: 7 additions & 0 deletions e2e/ng-lib-import/node_modules/my-lib/lib/my-lib.module.d.ts

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

Loading

0 comments on commit 99a4b1b

Please sign in to comment.