├── .editorconfig ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug.yml │ ├── config.yml │ ├── feature.yml │ └── question.yml ├── PULL_REQUEST_TEMPLATE.md ├── SUPPORT.md └── workflows │ ├── code_standard_check.yml │ ├── doc_ci.yml │ ├── install.yml │ ├── release.yml │ ├── source_code_ci.yml │ ├── test.yml │ └── test_performance.yml ├── .gitignore ├── .husky └── commit-msg ├── .npmignore ├── .prettierignore ├── .prettierrc.json ├── .yarn ├── plugins │ └── @yarnpkg │ │ └── plugin-outdated.cjs └── releases │ └── yarn-4.9.1.cjs ├── .yarnrc.yml ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── commitlint.config.ts ├── e2e ├── async │ ├── __tests__ │ │ └── async.spec.ts │ ├── jest-cjs.config.ts │ ├── jest-transpile-cjs.config.ts │ ├── tsconfig-cjs.spec.json │ └── tsconfig-transpile-cjs.spec.json ├── babel-support │ ├── .babelrc │ ├── __tests__ │ │ ├── babel-support.spec.ts │ │ └── main.js │ ├── jest-cjs.config.ts │ ├── jest-esm.config.ts │ ├── jest-transpile-cjs.config.ts │ ├── jest-transpile-esm.config.ts │ ├── tsconfig-cjs.spec.json │ ├── tsconfig-esm.spec.json │ ├── tsconfig-transpile-cjs.spec.json │ └── tsconfig-transpile-esm.spec.json ├── custom-jsdom-env │ ├── __tests__ │ │ └── custom-jsdom-env.spec.ts │ ├── foo.component.html │ ├── foo.component.scss │ ├── foo.component.ts │ ├── jest-cjs.config.ts │ ├── jest-esm.config.ts │ ├── jest-transpile-cjs.config.ts │ ├── jest-transpile-esm.config.ts │ ├── package.json │ ├── tsconfig-cjs.spec.json │ ├── tsconfig-esm.spec.json │ ├── tsconfig-transpile-cjs.spec.json │ ├── tsconfig-transpile-esm.spec.json │ └── yarn.lock ├── full-ivy-lib │ ├── __tests__ │ │ └── full-ivy-lib.spec.ts │ ├── jest-cjs.config.ts │ ├── jest-esm.config.ts │ ├── jest-transpile-cjs.config.ts │ ├── jest-transpile-esm.config.ts │ ├── node_modules │ │ └── full-ivy │ │ │ ├── README.md │ │ │ ├── esm2020 │ │ │ ├── full-ivy.mjs │ │ │ ├── lib │ │ │ │ ├── full-ivy.component.mjs │ │ │ │ ├── full-ivy.module.mjs │ │ │ │ └── full-ivy.service.mjs │ │ │ └── public-api.mjs │ │ │ ├── fesm2015 │ │ │ ├── full-ivy.mjs │ │ │ └── full-ivy.mjs.map │ │ │ ├── fesm2020 │ │ │ ├── full-ivy.mjs │ │ │ └── full-ivy.mjs.map │ │ │ ├── full-ivy.d.ts │ │ │ ├── lib │ │ │ ├── full-ivy.component.d.ts │ │ │ ├── full-ivy.module.d.ts │ │ │ └── full-ivy.service.d.ts │ │ │ ├── package.json │ │ │ └── public-api.d.ts │ ├── tsconfig-cjs.spec.json │ ├── tsconfig-esm.spec.json │ ├── tsconfig-transpile-cjs.spec.json │ └── tsconfig-transpile-esm.spec.json ├── global-setup.ts ├── hoisting │ ├── __test_modules__ │ │ ├── Mocked.ts │ │ ├── Unmocked.ts │ │ ├── a.ts │ │ ├── b.ts │ │ ├── banana.ts │ │ ├── c.ts │ │ ├── d.ts │ │ ├── e.ts │ │ └── mockFile.ts │ ├── __tests__ │ │ ├── general-hoisting.spec.ts │ │ └── import-jest.spec.ts │ ├── jest-cjs.config.ts │ ├── jest-transpile-cjs.config.ts │ ├── tsconfig-cjs.spec.json │ └── tsconfig-transpile-cjs.spec.json ├── ng-deep-import │ ├── __tests__ │ │ └── ng-deep-import.spec.ts │ ├── jest-cjs.config.ts │ ├── jest-esm.config.ts │ ├── jest-transpile-cjs.config.ts │ ├── jest-transpile-esm.config.ts │ ├── tsconfig-cjs.spec.json │ ├── tsconfig-esm.spec.json │ ├── tsconfig-transpile-cjs.spec.json │ └── tsconfig-transpile-esm.spec.json ├── ng-jit-transformers │ ├── __tests__ │ │ ├── downlevel-ctor.spec.ts │ │ ├── replace-resource.spec.ts │ │ ├── signal-inputs.spec.ts │ │ └── signal-queries.spec.ts │ ├── bar.component.html │ ├── bar.component.scss │ ├── bar.component.ts │ ├── jest-cjs.config.ts │ ├── jest-esm.config.ts │ ├── jest-transpile-cjs.config.ts │ ├── jest-transpile-esm.config.ts │ ├── tsconfig-cjs.spec.json │ ├── tsconfig-esm.spec.json │ ├── tsconfig-transpile-cjs.spec.json │ └── tsconfig-transpile-esm.spec.json ├── partial-ivy-lib │ ├── __tests__ │ │ └── partial-ivy-lib.spec.ts │ ├── jest-cjs.config.ts │ ├── jest-esm.config.ts │ ├── jest-transpile-cjs.config.ts │ ├── jest-transpile-esm.config.ts │ ├── node_modules │ │ └── partial-ivy │ │ │ ├── README.md │ │ │ ├── esm2020 │ │ │ ├── lib │ │ │ │ ├── partial-ivy.component.mjs │ │ │ │ ├── partial-ivy.module.mjs │ │ │ │ └── partial-ivy.service.mjs │ │ │ ├── partial-ivy.mjs │ │ │ ├── public-api.mjs │ │ │ └── testing │ │ │ │ ├── index.mjs │ │ │ │ └── partial-ivy-testing.mjs │ │ │ ├── fesm2015 │ │ │ ├── partial-ivy-testing.mjs │ │ │ ├── partial-ivy-testing.mjs.map │ │ │ ├── partial-ivy.mjs │ │ │ └── partial-ivy.mjs.map │ │ │ ├── fesm2020 │ │ │ ├── partial-ivy-testing.mjs │ │ │ ├── partial-ivy-testing.mjs.map │ │ │ ├── partial-ivy.mjs │ │ │ └── partial-ivy.mjs.map │ │ │ ├── lib │ │ │ ├── partial-ivy.component.d.ts │ │ │ ├── partial-ivy.module.d.ts │ │ │ └── partial-ivy.service.d.ts │ │ │ ├── package.json │ │ │ ├── partial-ivy.d.ts │ │ │ ├── public-api.d.ts │ │ │ └── testing │ │ │ ├── index.d.ts │ │ │ ├── package.json │ │ │ └── partial-ivy-testing.d.ts │ ├── tsconfig-cjs.spec.json │ ├── tsconfig-esm.spec.json │ ├── tsconfig-transpile-cjs.spec.json │ └── tsconfig-transpile-esm.spec.json ├── process-js-packages │ ├── __tests__ │ │ └── process-js-packages.spec.ts │ ├── jest-cjs.config.ts │ ├── jest-esm.config.ts │ ├── jest-transpile-cjs.config.ts │ ├── jest-transpile-esm.config.ts │ ├── package.json │ ├── tsconfig-cjs.spec.json │ ├── tsconfig-esm.spec.json │ ├── tsconfig-transpile-cjs.spec.json │ ├── tsconfig-transpile-esm.spec.json │ └── yarn.lock ├── setup-test-env.mts ├── setup-test-env.ts ├── snapshot-serializers │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── snapshot-serializers.spec.ts.snap │ │ └── snapshot-serializers.spec.ts │ ├── foo.component.html │ ├── foo.component.scss │ ├── foo.component.ts │ ├── jest-cjs.config.ts │ ├── jest-esm.config.ts │ ├── jest-transpile-cjs.config.ts │ ├── jest-transpile-esm.config.ts │ ├── tsconfig-cjs.spec.json │ ├── tsconfig-esm.spec.json │ ├── tsconfig-transpile-cjs.spec.json │ └── tsconfig-transpile-esm.spec.json └── zoneless-env │ ├── __tests__ │ └── zoneless-env.spec.ts │ ├── foo.component.html │ ├── foo.component.scss │ ├── foo.component.ts │ ├── jest-cjs.config.ts │ ├── jest-esm.config.ts │ ├── jest-transpile-cjs.config.ts │ ├── jest-transpile-esm.config.ts │ ├── setup-zoneless-env.mts │ ├── setup-zoneless-env.ts │ ├── tsconfig-cjs.spec.json │ ├── tsconfig-esm.spec.json │ ├── tsconfig-transpile-cjs.spec.json │ └── tsconfig-transpile-esm.spec.json ├── environments ├── jest-jsdom-env.d.ts └── jest-jsdom-env.js ├── eslint.config.mjs ├── examples ├── example-app-monorepo │ ├── .editorconfig │ ├── .gitignore │ ├── README.md │ ├── angular.json │ ├── apps │ │ └── app1 │ │ │ ├── jest-esm-isolated.config.ts │ │ │ ├── jest-esm.config.ts │ │ │ ├── jest-global-mocks.ts │ │ │ ├── jest-isolated.config.ts │ │ │ ├── jest.config.ts │ │ │ ├── setup-jest-esm.ts │ │ │ ├── setup-jest.ts │ │ │ ├── src │ │ │ ├── app │ │ │ │ ├── about │ │ │ │ │ ├── about.component.spec.ts │ │ │ │ │ └── about.component.ts │ │ │ │ ├── app-initial.component.spec.ts │ │ │ │ ├── app-initial.component.ts │ │ │ │ ├── app.component.html │ │ │ │ ├── app.component.router.spec.ts │ │ │ │ ├── app.component.spec.ts │ │ │ │ ├── app.component.ts │ │ │ │ ├── app.config.ts │ │ │ │ ├── app.routes.ts │ │ │ │ ├── banner │ │ │ │ │ ├── banner-external.component.css │ │ │ │ │ ├── banner-external.component.html │ │ │ │ │ ├── banner-external.component.spec.ts │ │ │ │ │ ├── banner-external.component.ts │ │ │ │ │ ├── banner-initial.component.spec.ts │ │ │ │ │ ├── banner-initial.component.ts │ │ │ │ │ ├── banner.component.detect-changes.spec.ts │ │ │ │ │ ├── banner.component.spec.ts │ │ │ │ │ └── banner.component.ts │ │ │ │ ├── dashboard │ │ │ │ │ ├── dashboard-hero.component.css │ │ │ │ │ ├── dashboard-hero.component.spec.ts │ │ │ │ │ ├── dashboard-hero.component.ts │ │ │ │ │ ├── dashboard.component.css │ │ │ │ │ ├── dashboard.component.html │ │ │ │ │ ├── dashboard.component.no-testbed.spec.ts │ │ │ │ │ ├── dashboard.component.spec.ts │ │ │ │ │ └── dashboard.component.ts │ │ │ │ ├── demo │ │ │ │ │ ├── async-helper.spec.ts │ │ │ │ │ ├── demo-external-template.html │ │ │ │ │ ├── demo-main.ts │ │ │ │ │ ├── demo.spec.ts │ │ │ │ │ ├── demo.testbed.spec.ts │ │ │ │ │ └── demo.ts │ │ │ │ ├── hero │ │ │ │ │ ├── hero-detail.component.css │ │ │ │ │ ├── hero-detail.component.html │ │ │ │ │ ├── hero-detail.component.spec.ts │ │ │ │ │ ├── hero-detail.component.ts │ │ │ │ │ ├── hero-detail.service.ts │ │ │ │ │ ├── hero-list.component.css │ │ │ │ │ ├── hero-list.component.html │ │ │ │ │ ├── hero-list.component.spec.ts │ │ │ │ │ ├── hero-list.component.ts │ │ │ │ │ └── hero.routes.ts │ │ │ │ ├── in-memory-data.service.ts │ │ │ │ ├── model │ │ │ │ │ ├── hero.service.spec.ts │ │ │ │ │ ├── hero.service.ts │ │ │ │ │ ├── hero.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ └── testing │ │ │ │ │ │ ├── http-client.spec.ts │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ ├── test-hero.service.ts │ │ │ │ │ │ └── test-heroes.ts │ │ │ │ ├── shared │ │ │ │ │ ├── app.service.spec.ts │ │ │ │ │ ├── app.service.ts │ │ │ │ │ ├── app.tokens.ts │ │ │ │ │ ├── canvas.component.spec.ts │ │ │ │ │ ├── canvas.component.ts │ │ │ │ │ ├── foo.component.spec.ts │ │ │ │ │ ├── foo.component.ts │ │ │ │ │ ├── highlight.directive.spec.ts │ │ │ │ │ ├── highlight.directive.ts │ │ │ │ │ ├── shared.ts │ │ │ │ │ ├── title-case.pipe.spec.ts │ │ │ │ │ └── title-case.pipe.ts │ │ │ │ ├── twain │ │ │ │ │ ├── quote.ts │ │ │ │ │ ├── twain.component.spec.ts │ │ │ │ │ ├── twain.component.ts │ │ │ │ │ ├── twain.data.ts │ │ │ │ │ └── twain.service.ts │ │ │ │ └── welcome │ │ │ │ │ ├── welcome.component.spec.ts │ │ │ │ │ └── welcome.component.ts │ │ │ ├── favicon.ico │ │ │ ├── index.html │ │ │ ├── main.ts │ │ │ ├── styles.css │ │ │ └── testing │ │ │ │ ├── async-observable-helpers.ts │ │ │ │ └── index.ts │ │ │ ├── tsconfig-esm.spec.json │ │ │ ├── tsconfig-isolated-esm.spec.json │ │ │ ├── tsconfig-isolated.spec.json │ │ │ ├── tsconfig.app.json │ │ │ ├── tsconfig.json │ │ │ └── tsconfig.spec.json │ ├── jest-esm-isolated.config.ts │ ├── jest-esm.config.ts │ ├── jest-isolated.config.ts │ ├── jest.config.ts │ ├── libs │ │ └── user │ │ │ ├── README.md │ │ │ ├── jest-esm-isolated.config.ts │ │ │ ├── jest-esm.config.ts │ │ │ ├── jest-global-mocks.ts │ │ │ ├── jest-isolated.config.ts │ │ │ ├── jest.config.ts │ │ │ ├── ng-package.json │ │ │ ├── package.json │ │ │ ├── setup-jest-esm.ts │ │ │ ├── setup-jest.ts │ │ │ ├── src │ │ │ ├── lib │ │ │ │ ├── user.service.spec.ts │ │ │ │ └── user.service.ts │ │ │ └── public-api.ts │ │ │ ├── tsconfig-esm.spec.json │ │ │ ├── tsconfig-isolated-esm.spec.json │ │ │ ├── tsconfig-isolated.spec.json │ │ │ ├── tsconfig.lib.json │ │ │ ├── tsconfig.lib.prod.json │ │ │ └── tsconfig.spec.json │ ├── package.json │ ├── tsconfig.json │ └── yarn.lock ├── example-app-v18 │ ├── .editorconfig │ ├── .gitignore │ ├── angular.json │ ├── jest-esm-isolated.config.ts │ ├── jest-esm.config.ts │ ├── jest-global-mocks.ts │ ├── jest-isolated.config.ts │ ├── jest.config.ts │ ├── package.json │ ├── public │ │ └── favicon.ico │ ├── setup-jest-esm.ts │ ├── setup-jest.ts │ ├── src │ │ ├── app │ │ │ ├── about │ │ │ │ ├── about.component.spec.ts │ │ │ │ └── about.component.ts │ │ │ ├── app-initial.component.spec.ts │ │ │ ├── app-initial.component.ts │ │ │ ├── app.component.html │ │ │ ├── app.component.router.spec.ts │ │ │ ├── app.component.spec.ts │ │ │ ├── app.component.ts │ │ │ ├── app.config.ts │ │ │ ├── app.routes.ts │ │ │ ├── banner │ │ │ │ ├── banner-external.component.css │ │ │ │ ├── banner-external.component.html │ │ │ │ ├── banner-external.component.spec.ts │ │ │ │ ├── banner-external.component.ts │ │ │ │ ├── banner-initial.component.spec.ts │ │ │ │ ├── banner-initial.component.ts │ │ │ │ ├── banner.component.detect-changes.spec.ts │ │ │ │ ├── banner.component.spec.ts │ │ │ │ └── banner.component.ts │ │ │ ├── dashboard │ │ │ │ ├── dashboard-hero.component.css │ │ │ │ ├── dashboard-hero.component.spec.ts │ │ │ │ ├── dashboard-hero.component.ts │ │ │ │ ├── dashboard.component.css │ │ │ │ ├── dashboard.component.html │ │ │ │ ├── dashboard.component.no-testbed.spec.ts │ │ │ │ ├── dashboard.component.spec.ts │ │ │ │ └── dashboard.component.ts │ │ │ ├── demo │ │ │ │ ├── async-helper.spec.ts │ │ │ │ ├── demo-external-template.html │ │ │ │ ├── demo-main.ts │ │ │ │ ├── demo.spec.ts │ │ │ │ ├── demo.testbed.spec.ts │ │ │ │ └── demo.ts │ │ │ ├── hero │ │ │ │ ├── hero-detail.component.css │ │ │ │ ├── hero-detail.component.html │ │ │ │ ├── hero-detail.component.spec.ts │ │ │ │ ├── hero-detail.component.ts │ │ │ │ ├── hero-detail.service.ts │ │ │ │ ├── hero-list.component.css │ │ │ │ ├── hero-list.component.html │ │ │ │ ├── hero-list.component.spec.ts │ │ │ │ ├── hero-list.component.ts │ │ │ │ └── hero.routes.ts │ │ │ ├── in-memory-data.service.ts │ │ │ ├── model │ │ │ │ ├── hero.service.spec.ts │ │ │ │ ├── hero.service.ts │ │ │ │ ├── hero.ts │ │ │ │ ├── index.ts │ │ │ │ ├── testing │ │ │ │ │ ├── http-client.spec.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── test-hero.service.ts │ │ │ │ │ └── test-heroes.ts │ │ │ │ └── user.service.ts │ │ │ ├── shared │ │ │ │ ├── app.service.spec.ts │ │ │ │ ├── app.service.ts │ │ │ │ ├── app.tokens.ts │ │ │ │ ├── canvas.component.spec.ts │ │ │ │ ├── canvas.component.ts │ │ │ │ ├── foo.component.spec.ts │ │ │ │ ├── foo.component.ts │ │ │ │ ├── highlight.directive.spec.ts │ │ │ │ ├── highlight.directive.ts │ │ │ │ ├── shared.ts │ │ │ │ ├── title-case.pipe.spec.ts │ │ │ │ └── title-case.pipe.ts │ │ │ ├── twain │ │ │ │ ├── quote.ts │ │ │ │ ├── twain.component.spec.ts │ │ │ │ ├── twain.component.ts │ │ │ │ ├── twain.data.ts │ │ │ │ └── twain.service.ts │ │ │ └── welcome │ │ │ │ ├── welcome.component.spec.ts │ │ │ │ └── welcome.component.ts │ │ ├── index.html │ │ ├── main.ts │ │ ├── styles.css │ │ └── testing │ │ │ ├── async-observable-helpers.ts │ │ │ └── index.ts │ ├── tsconfig-esm.spec.json │ ├── tsconfig-isolated-esm.spec.json │ ├── tsconfig-isolated.spec.json │ ├── tsconfig.app.json │ ├── tsconfig.json │ ├── tsconfig.spec.json │ └── yarn.lock ├── example-app-v19 │ ├── .editorconfig │ ├── .gitignore │ ├── angular.json │ ├── jest-esm-isolated.config.ts │ ├── jest-esm.config.ts │ ├── jest-global-mocks.ts │ ├── jest-isolated.config.ts │ ├── jest.config.ts │ ├── package.json │ ├── public │ │ └── favicon.ico │ ├── setup-jest-esm.ts │ ├── setup-jest.ts │ ├── src │ │ ├── app │ │ │ ├── about │ │ │ │ ├── about.component.spec.ts │ │ │ │ └── about.component.ts │ │ │ ├── app-initial.component.spec.ts │ │ │ ├── app-initial.component.ts │ │ │ ├── app.component.html │ │ │ ├── app.component.router.spec.ts │ │ │ ├── app.component.spec.ts │ │ │ ├── app.component.ts │ │ │ ├── app.config.ts │ │ │ ├── app.routes.ts │ │ │ ├── banner │ │ │ │ ├── banner-external.component.css │ │ │ │ ├── banner-external.component.html │ │ │ │ ├── banner-external.component.spec.ts │ │ │ │ ├── banner-external.component.ts │ │ │ │ ├── banner-initial.component.spec.ts │ │ │ │ ├── banner-initial.component.ts │ │ │ │ ├── banner.component.detect-changes.spec.ts │ │ │ │ ├── banner.component.spec.ts │ │ │ │ └── banner.component.ts │ │ │ ├── dashboard │ │ │ │ ├── dashboard-hero.component.css │ │ │ │ ├── dashboard-hero.component.spec.ts │ │ │ │ ├── dashboard-hero.component.ts │ │ │ │ ├── dashboard.component.css │ │ │ │ ├── dashboard.component.html │ │ │ │ ├── dashboard.component.no-testbed.spec.ts │ │ │ │ ├── dashboard.component.spec.ts │ │ │ │ └── dashboard.component.ts │ │ │ ├── demo │ │ │ │ ├── async-helper.spec.ts │ │ │ │ ├── demo-external-template.html │ │ │ │ ├── demo-main.ts │ │ │ │ ├── demo.spec.ts │ │ │ │ ├── demo.testbed.spec.ts │ │ │ │ └── demo.ts │ │ │ ├── hero │ │ │ │ ├── hero-detail.component.css │ │ │ │ ├── hero-detail.component.html │ │ │ │ ├── hero-detail.component.spec.ts │ │ │ │ ├── hero-detail.component.ts │ │ │ │ ├── hero-detail.service.ts │ │ │ │ ├── hero-list.component.css │ │ │ │ ├── hero-list.component.html │ │ │ │ ├── hero-list.component.spec.ts │ │ │ │ ├── hero-list.component.ts │ │ │ │ └── hero.routes.ts │ │ │ ├── in-memory-data.service.ts │ │ │ ├── model │ │ │ │ ├── hero.service.spec.ts │ │ │ │ ├── hero.service.ts │ │ │ │ ├── hero.ts │ │ │ │ ├── index.ts │ │ │ │ ├── testing │ │ │ │ │ ├── http-client.spec.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── test-hero.service.ts │ │ │ │ │ └── test-heroes.ts │ │ │ │ └── user.service.ts │ │ │ ├── shared │ │ │ │ ├── app.service.spec.ts │ │ │ │ ├── app.service.ts │ │ │ │ ├── app.tokens.ts │ │ │ │ ├── canvas.component.spec.ts │ │ │ │ ├── canvas.component.ts │ │ │ │ ├── foo.component.spec.ts │ │ │ │ ├── foo.component.ts │ │ │ │ ├── highlight.directive.spec.ts │ │ │ │ ├── highlight.directive.ts │ │ │ │ ├── shared.ts │ │ │ │ ├── title-case.pipe.spec.ts │ │ │ │ └── title-case.pipe.ts │ │ │ ├── twain │ │ │ │ ├── quote.ts │ │ │ │ ├── twain.component.spec.ts │ │ │ │ ├── twain.component.ts │ │ │ │ ├── twain.data.ts │ │ │ │ └── twain.service.ts │ │ │ └── welcome │ │ │ │ ├── welcome.component.spec.ts │ │ │ │ └── welcome.component.ts │ │ ├── index.html │ │ ├── main.ts │ │ ├── styles.css │ │ └── testing │ │ │ ├── async-observable-helpers.ts │ │ │ └── index.ts │ ├── tsconfig-esm.spec.json │ ├── tsconfig-isolated-esm.spec.json │ ├── tsconfig-isolated.spec.json │ ├── tsconfig.app.json │ ├── tsconfig.json │ ├── tsconfig.spec.json │ └── yarn.lock └── example-app-v20 │ ├── .editorconfig │ ├── .gitignore │ ├── angular.json │ ├── jest-esm-isolated.config.ts │ ├── jest-esm.config.ts │ ├── jest-global-mocks.ts │ ├── jest-isolated.config.ts │ ├── jest.config.ts │ ├── package.json │ ├── public │ └── favicon.ico │ ├── setup-jest-esm.ts │ ├── setup-jest.ts │ ├── src │ ├── app │ │ ├── about │ │ │ ├── about.component.spec.ts │ │ │ └── about.component.ts │ │ ├── app-initial.spec.ts │ │ ├── app-initial.ts │ │ ├── app.config.ts │ │ ├── app.html │ │ ├── app.router.spec.ts │ │ ├── app.routes.ts │ │ ├── app.spec.ts │ │ ├── app.ts │ │ ├── banner │ │ │ ├── banner-external.component.css │ │ │ ├── banner-external.component.html │ │ │ ├── banner-external.component.spec.ts │ │ │ ├── banner-external.component.ts │ │ │ ├── banner-initial.component.spec.ts │ │ │ ├── banner-initial.component.ts │ │ │ ├── banner.component.detect-changes.spec.ts │ │ │ ├── banner.component.spec.ts │ │ │ └── banner.component.ts │ │ ├── dashboard │ │ │ ├── dashboard-hero.component.css │ │ │ ├── dashboard-hero.component.spec.ts │ │ │ ├── dashboard-hero.component.ts │ │ │ ├── dashboard.component.css │ │ │ ├── dashboard.component.html │ │ │ ├── dashboard.component.no-testbed.spec.ts │ │ │ ├── dashboard.component.spec.ts │ │ │ └── dashboard.component.ts │ │ ├── demo │ │ │ ├── async-helper.spec.ts │ │ │ ├── demo-external-template.html │ │ │ ├── demo-main.ts │ │ │ ├── demo.spec.ts │ │ │ ├── demo.testbed.spec.ts │ │ │ └── demo.ts │ │ ├── hero │ │ │ ├── hero-detail.component.css │ │ │ ├── hero-detail.component.html │ │ │ ├── hero-detail.component.spec.ts │ │ │ ├── hero-detail.component.ts │ │ │ ├── hero-detail.service.ts │ │ │ ├── hero-list.component.css │ │ │ ├── hero-list.component.html │ │ │ ├── hero-list.component.spec.ts │ │ │ ├── hero-list.component.ts │ │ │ └── hero.routes.ts │ │ ├── in-memory-data.service.ts │ │ ├── model │ │ │ ├── hero.service.spec.ts │ │ │ ├── hero.service.ts │ │ │ ├── hero.ts │ │ │ ├── index.ts │ │ │ ├── testing │ │ │ │ ├── http-client.spec.ts │ │ │ │ ├── index.ts │ │ │ │ ├── test-hero.service.ts │ │ │ │ └── test-heroes.ts │ │ │ └── user.service.ts │ │ ├── shared │ │ │ ├── app.service.spec.ts │ │ │ ├── app.service.ts │ │ │ ├── app.tokens.ts │ │ │ ├── canvas.component.spec.ts │ │ │ ├── canvas.component.ts │ │ │ ├── foo.component.spec.ts │ │ │ ├── foo.component.ts │ │ │ ├── highlight.directive.spec.ts │ │ │ ├── highlight.directive.ts │ │ │ ├── shared.ts │ │ │ ├── title-case.pipe.spec.ts │ │ │ └── title-case.pipe.ts │ │ ├── twain │ │ │ ├── quote.ts │ │ │ ├── twain.component.spec.ts │ │ │ ├── twain.component.ts │ │ │ ├── twain.data.ts │ │ │ └── twain.service.ts │ │ └── welcome │ │ │ ├── welcome.component.spec.ts │ │ │ └── welcome.component.ts │ ├── index.html │ ├── main.ts │ ├── styles.css │ └── testing │ │ ├── async-observable-helpers.ts │ │ └── index.ts │ ├── tsconfig-esm.spec.json │ ├── tsconfig-isolated-esm.spec.json │ ├── tsconfig-isolated.spec.json │ ├── tsconfig.app.json │ ├── tsconfig.json │ ├── tsconfig.spec.json │ └── yarn.lock ├── global-setup.js ├── global-setup.mjs ├── jest-cjs.config.ts ├── jest-esm.config.ts ├── jest-preset.js ├── jest.config.ts ├── package.json ├── performance ├── __tests__ │ └── perf.spec.ts ├── jest.config.ts ├── package.json ├── tsconfig.json └── yarn.lock ├── presets ├── defaults-esm │ └── jest-preset.js ├── defaults │ └── jest-preset.js ├── index.d.ts └── index.js ├── renovate.json ├── scripts ├── logger.js ├── paths.js ├── prebuild.js └── test-examples.js ├── setup-env ├── utils.js ├── zone │ ├── index.d.mts │ ├── index.d.ts │ ├── index.js │ └── index.mjs └── zoneless │ ├── index.d.mts │ ├── index.d.ts │ ├── index.js │ └── index.mjs ├── setup-jest.js ├── setup-jest.mjs ├── sonar-project.properties ├── src ├── __snapshots__ │ └── ng-jest-transformer.spec.ts.snap ├── compiler │ ├── ng-jest-compiler.spec.ts │ └── ng-jest-compiler.ts ├── config │ ├── global-setup.spec.ts │ ├── global-setup.ts │ ├── ng-jest-config.spec.ts │ ├── ng-jest-config.ts │ └── setup-jest.spec.ts ├── constants.ts ├── environments │ ├── jest-env-jsdom-abstract.ts │ ├── jest-jsdom-env.spec.ts │ └── jest-jsdom-env.ts ├── global.d.ts ├── index.ts ├── ng-jest-transformer.spec.ts ├── ng-jest-transformer.ts ├── presets │ ├── __snapshots__ │ │ └── index.spec.ts.snap │ ├── create-cjs-preset.ts │ ├── create-esm-preset.ts │ ├── index.spec.ts │ ├── index.ts │ └── utils.ts ├── resolvers │ ├── ng-jest-resolver.spec.ts │ └── ng-jest-resolver.ts ├── serializers │ ├── html-comment.spec.ts │ ├── html-comment.ts │ ├── index.spec.ts │ ├── index.ts │ ├── ng-snapshot.spec.ts │ ├── ng-snapshot.ts │ ├── no-ng-attributes.spec.ts │ └── no-ng-attributes.ts ├── transformers │ ├── esm_interop_inject.cjs │ ├── jit_transform.d.ts │ └── replace-resources.ts └── utils │ └── ngcc-jest-processor.ts ├── tsconfig-base.spec.json ├── tsconfig.build.json ├── tsconfig.eslint.json ├── tsconfig.json ├── website ├── .gitignore ├── README.md ├── babel.config.js ├── docs │ ├── getting-started │ │ ├── installation.md │ │ ├── options.md │ │ ├── presets.md │ │ ├── test-environment.md │ │ └── testbed-environment.md │ ├── guides │ │ ├── absolute-imports.md │ │ ├── angular-13+.md │ │ ├── angular-ivy.md │ │ ├── esm-support.md │ │ ├── jsdom-environment.md │ │ ├── jsdom-version.md │ │ ├── snapshot-testing.md │ │ ├── troubleshooting.md │ │ └── using-with-babel.md │ ├── introduction.md │ └── processing.md ├── docusaurus.config.ts ├── package.json ├── sidebars.json ├── src │ ├── css │ │ └── custom.css │ └── pages │ │ ├── index.tsx │ │ ├── styles.module.css │ │ └── versions.tsx ├── static │ ├── .nojekyll │ ├── img │ │ ├── discord.svg │ │ ├── documentation.png │ │ ├── github.png │ │ ├── logo.svg │ │ ├── pull-request.png │ │ └── troubleshooting.png │ └── manifest.json ├── tsconfig.json ├── versioned_docs │ ├── version-10.x │ │ ├── getting-started │ │ │ ├── installation.md │ │ │ ├── options.md │ │ │ ├── presets.md │ │ │ └── test-environment.md │ │ ├── guides │ │ │ ├── absolute-imports.md │ │ │ ├── angular-ivy.md │ │ │ ├── esm-support.md │ │ │ ├── jsdom-version.md │ │ │ ├── troubleshooting.md │ │ │ └── using-with-babel.md │ │ ├── introduction.md │ │ └── processing.md │ ├── version-11.0 │ │ ├── getting-started │ │ │ ├── installation.md │ │ │ ├── options.md │ │ │ ├── presets.md │ │ │ └── test-environment.md │ │ ├── guides │ │ │ ├── absolute-imports.md │ │ │ ├── angular-13+.md │ │ │ ├── angular-ivy.md │ │ │ ├── esm-support.md │ │ │ ├── jsdom-version.md │ │ │ ├── troubleshooting.md │ │ │ └── using-with-babel.md │ │ ├── introduction.md │ │ └── processing.md │ ├── version-11.1 │ │ ├── getting-started │ │ │ ├── installation.md │ │ │ ├── options.md │ │ │ ├── presets.md │ │ │ └── test-environment.md │ │ ├── guides │ │ │ ├── absolute-imports.md │ │ │ ├── angular-13+.md │ │ │ ├── angular-ivy.md │ │ │ ├── esm-support.md │ │ │ ├── jsdom-version.md │ │ │ ├── troubleshooting.md │ │ │ └── using-with-babel.md │ │ ├── introduction.md │ │ └── processing.md │ ├── version-12.0 │ │ ├── getting-started │ │ │ ├── installation.md │ │ │ ├── options.md │ │ │ ├── presets.md │ │ │ └── test-environment.md │ │ ├── guides │ │ │ ├── absolute-imports.md │ │ │ ├── angular-13+.md │ │ │ ├── angular-ivy.md │ │ │ ├── esm-support.md │ │ │ ├── jsdom-version.md │ │ │ ├── troubleshooting.md │ │ │ └── using-with-babel.md │ │ ├── introduction.md │ │ └── processing.md │ ├── version-13.0 │ │ ├── getting-started │ │ │ ├── installation.md │ │ │ ├── options.md │ │ │ ├── presets.md │ │ │ └── test-environment.md │ │ ├── guides │ │ │ ├── absolute-imports.md │ │ │ ├── angular-13+.md │ │ │ ├── angular-ivy.md │ │ │ ├── esm-support.md │ │ │ ├── jsdom-version.md │ │ │ ├── troubleshooting.md │ │ │ └── using-with-babel.md │ │ ├── introduction.md │ │ └── processing.md │ ├── version-14.0 │ │ ├── getting-started │ │ │ ├── installation.md │ │ │ ├── options.md │ │ │ ├── presets.md │ │ │ └── test-environment.md │ │ ├── guides │ │ │ ├── absolute-imports.md │ │ │ ├── angular-13+.md │ │ │ ├── angular-ivy.md │ │ │ ├── esm-support.md │ │ │ ├── jsdom-version.md │ │ │ ├── troubleshooting.md │ │ │ └── using-with-babel.md │ │ ├── introduction.md │ │ └── processing.md │ ├── version-14.2 │ │ ├── getting-started │ │ │ ├── installation.md │ │ │ ├── options.md │ │ │ ├── presets.md │ │ │ └── test-environment.md │ │ ├── guides │ │ │ ├── absolute-imports.md │ │ │ ├── angular-13+.md │ │ │ ├── angular-ivy.md │ │ │ ├── esm-support.md │ │ │ ├── jsdom-version.md │ │ │ ├── snapshot-testing.md │ │ │ ├── troubleshooting.md │ │ │ └── using-with-babel.md │ │ ├── introduction.md │ │ └── processing.md │ ├── version-14.3 │ │ ├── getting-started │ │ │ ├── installation.md │ │ │ ├── options.md │ │ │ ├── presets.md │ │ │ └── test-environment.md │ │ ├── guides │ │ │ ├── absolute-imports.md │ │ │ ├── angular-13+.md │ │ │ ├── angular-ivy.md │ │ │ ├── esm-support.md │ │ │ ├── jsdom-version.md │ │ │ ├── snapshot-testing.md │ │ │ ├── troubleshooting.md │ │ │ └── using-with-babel.md │ │ ├── introduction.md │ │ └── processing.md │ ├── version-14.4 │ │ ├── getting-started │ │ │ ├── installation.md │ │ │ ├── options.md │ │ │ ├── presets.md │ │ │ └── test-environment.md │ │ ├── guides │ │ │ ├── absolute-imports.md │ │ │ ├── angular-13+.md │ │ │ ├── angular-ivy.md │ │ │ ├── esm-support.md │ │ │ ├── jsdom-version.md │ │ │ ├── snapshot-testing.md │ │ │ ├── troubleshooting.md │ │ │ └── using-with-babel.md │ │ ├── introduction.md │ │ └── processing.md │ ├── version-14.5 │ │ ├── getting-started │ │ │ ├── installation.md │ │ │ ├── options.md │ │ │ ├── presets.md │ │ │ ├── test-environment.md │ │ │ └── testbed-environment.md │ │ ├── guides │ │ │ ├── absolute-imports.md │ │ │ ├── angular-13+.md │ │ │ ├── angular-ivy.md │ │ │ ├── esm-support.md │ │ │ ├── jsdom-environment.md │ │ │ ├── jsdom-version.md │ │ │ ├── snapshot-testing.md │ │ │ ├── troubleshooting.md │ │ │ └── using-with-babel.md │ │ ├── introduction.md │ │ └── processing.md │ ├── version-14.6 │ │ ├── getting-started │ │ │ ├── installation.md │ │ │ ├── options.md │ │ │ ├── presets.md │ │ │ ├── test-environment.md │ │ │ └── testbed-environment.md │ │ ├── guides │ │ │ ├── absolute-imports.md │ │ │ ├── angular-13+.md │ │ │ ├── angular-ivy.md │ │ │ ├── esm-support.md │ │ │ ├── jsdom-environment.md │ │ │ ├── jsdom-version.md │ │ │ ├── snapshot-testing.md │ │ │ ├── troubleshooting.md │ │ │ └── using-with-babel.md │ │ ├── introduction.md │ │ └── processing.md │ ├── version-8.x │ │ ├── getting-started │ │ │ ├── installation.md │ │ │ ├── options.md │ │ │ ├── presets.md │ │ │ └── test-environment.md │ │ ├── guides │ │ │ ├── absolute-imports.md │ │ │ ├── angular-ivy.md │ │ │ ├── esm-support.md │ │ │ ├── jsdom-version.md │ │ │ ├── troubleshooting.md │ │ │ └── using-with-babel.md │ │ ├── introduction.md │ │ └── processing.md │ └── version-9.x │ │ ├── getting-started │ │ ├── installation.md │ │ ├── options.md │ │ ├── presets.md │ │ └── test-environment.md │ │ ├── guides │ │ ├── absolute-imports.md │ │ ├── angular-ivy.md │ │ ├── esm-support.md │ │ ├── jsdom-version.md │ │ ├── troubleshooting.md │ │ └── using-with-babel.md │ │ ├── introduction.md │ │ └── processing.md ├── versioned_sidebars │ ├── version-10.x-sidebars.json │ ├── version-11.0-sidebars.json │ ├── version-11.1-sidebars.json │ ├── version-12.0-sidebars.json │ ├── version-13.0-sidebars.json │ ├── version-14.0-sidebars.json │ ├── version-14.2-sidebars.json │ ├── version-14.3-sidebars.json │ ├── version-14.4-sidebars.json │ ├── version-14.5-sidebars.json │ ├── version-14.6-sidebars.json │ ├── version-8.x-sidebars.json │ └── version-9.x-sidebars.json ├── versions.json └── yarn.lock └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | ; top-most EditorConfig file 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | ; Unix-style newlines 7 | end_of_line = LF 8 | insert_final_newline = true 9 | indent_style = space 10 | trim_trailing_whitespace = true 11 | 12 | [*.php] 13 | indent_size = 4 14 | 15 | [Makefile{.custom, .custom.dist}] 16 | indent_style = tab 17 | tab_width = 4 18 | 19 | [*.{yml, yaml}] 20 | indent_size = 2 21 | 22 | [*.{js,jsx,ts,tsx,mjs,mjsx,tsx,mtsx}] 23 | indent_size = 4 24 | 25 | [*.html] 26 | indent_size = 4 27 | 28 | [*.graphql] 29 | indent_size = 4 30 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These owners will be the default owners for everything in 2 | # the repo. Unless a later match takes precedence, 3 | # @global-owner1 and @global-owner2 will be requested for 4 | # review when someone opens a pull request. 5 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Summary 4 | 5 | 6 | 7 | ## Test plan 8 | 9 | 10 | 11 | ## Does this PR introduce a breaking change? 12 | 13 | - [ ] Yes 14 | - [ ] No 15 | 16 | 17 | 18 | ## Other information 19 | -------------------------------------------------------------------------------- /.github/SUPPORT.md: -------------------------------------------------------------------------------- 1 | Please note this issue tracker is not a help forum. We recommend using [StackOverflow](https://stackoverflow.com/questions/tagged/jest-preset-angular) for questions. 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | /build 3 | *.log 4 | .idea 5 | *.tgz 6 | .yarn/* 7 | **/.yarn/* 8 | tmp 9 | .idx 10 | .vscode 11 | !.yarn/patches 12 | !.yarn/plugins 13 | !.yarn/releases 14 | !.yarn/sdks 15 | !.yarn/versions 16 | !/e2e/full-ivy-lib/node_modules 17 | !/e2e/partial-ivy-lib/node_modules 18 | 19 | # Generated by `yarn build-transformers-bundle` automatically. 20 | src/transformers/jit_transform.js 21 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | yarn commitlint --edit $1 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | build/ 2 | node_modules/ 3 | src/**/__snapshots__/ 4 | e2e/__tests__/__snapshots__/ 5 | CHANGELOG.md 6 | src/transformers/jit_transform.js 7 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "printWidth": 120, 4 | "singleQuote": true, 5 | "tabWidth": 2, 6 | "useTabs": false, 7 | "trailingComma": "all" 8 | } 9 | -------------------------------------------------------------------------------- /.yarnrc.yml: -------------------------------------------------------------------------------- 1 | compressionLevel: mixed 2 | 3 | enableGlobalCache: false 4 | 5 | nodeLinker: node-modules 6 | 7 | plugins: 8 | - path: .yarn/plugins/@yarnpkg/plugin-outdated.cjs 9 | spec: 'https://mskelton.dev/yarn-outdated/v3' 10 | 11 | yarnPath: .yarn/releases/yarn-4.9.1.cjs 12 | -------------------------------------------------------------------------------- /commitlint.config.ts: -------------------------------------------------------------------------------- 1 | import type { UserConfig } from '@commitlint/types'; 2 | 3 | export default { 4 | extends: ['@commitlint/config-angular'], 5 | rules: { 6 | 'subject-max-length': [2, 'always', 120], 7 | 'scope-enum': [2, 'always', []], 8 | 'scope-empty': [2, 'always'], 9 | 'type-enum': [ 10 | 2, 11 | 'always', 12 | ['build', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'release', 'revert', 'style', 'test'], 13 | ], 14 | }, 15 | } satisfies UserConfig; 16 | -------------------------------------------------------------------------------- /e2e/async/jest-cjs.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-async', 5 | testEnvironment: 'jsdom', 6 | setupFilesAfterEnv: ['/../setup-test-env.ts'], 7 | transform: { 8 | '^.+\\.(ts|mjs|js|html)$': [ 9 | '/../../build/index.js', 10 | { 11 | tsconfig: '/tsconfig-cjs.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 17 | }; 18 | 19 | export default config; 20 | -------------------------------------------------------------------------------- /e2e/async/jest-transpile-cjs.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-async', 5 | testEnvironment: 'jsdom', 6 | setupFilesAfterEnv: ['/../setup-test-env.ts'], 7 | transform: { 8 | '^.+\\.(ts|mjs|js|html)$': [ 9 | '/../../build/index.js', 10 | { 11 | tsconfig: '/tsconfig-transpile-cjs.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 17 | }; 18 | 19 | export default config; 20 | -------------------------------------------------------------------------------- /e2e/async/tsconfig-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/async/tsconfig-transpile-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-cjs.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/babel-support/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "@babel/preset-env" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /e2e/babel-support/__tests__/babel-support.spec.ts: -------------------------------------------------------------------------------- 1 | it('should work', () => { 2 | expect({ ...{ bar: 'foo' }, foo: 'bar' }).toEqual({ foo: 'bar', bar: 'foo' }); 3 | }); 4 | -------------------------------------------------------------------------------- /e2e/babel-support/__tests__/main.js: -------------------------------------------------------------------------------- 1 | it('should work', () => { 2 | expect({ ...{ bar: 'foo' }, foo: 'bar' }).toEqual({ foo: 'bar', bar: 'foo' }); 3 | }); 4 | -------------------------------------------------------------------------------- /e2e/babel-support/jest-cjs.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-babel-support', 5 | testEnvironment: 'jsdom', 6 | transform: { 7 | '^.+\\.(ts|mjs|js|html)$': [ 8 | '/../../build/index.js', 9 | { 10 | babelConfig: true, 11 | tsconfig: '/tsconfig-cjs.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | }; 17 | 18 | export default config; 19 | -------------------------------------------------------------------------------- /e2e/babel-support/jest-esm.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-babel-support', 5 | extensionsToTreatAsEsm: ['.ts', '.mts'], 6 | transform: { 7 | '^.+\\.(ts|mts|mjs|js|html)$': [ 8 | '/../../build/index.js', 9 | { 10 | babelConfig: true, 11 | useESM: true, 12 | tsconfig: '/tsconfig-esm.spec.json', 13 | }, 14 | ], 15 | }, 16 | }; 17 | 18 | export default config; 19 | -------------------------------------------------------------------------------- /e2e/babel-support/jest-transpile-cjs.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-babel-support', 5 | testEnvironment: 'jsdom', 6 | transform: { 7 | '^.+\\.(ts|mjs|js|html)$': [ 8 | '/../../build/index.js', 9 | { 10 | babelConfig: true, 11 | tsconfig: '/tsconfig-transpile-cjs.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | }; 17 | 18 | export default config; 19 | -------------------------------------------------------------------------------- /e2e/babel-support/jest-transpile-esm.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-babel-support', 5 | extensionsToTreatAsEsm: ['.ts', '.mts'], 6 | transform: { 7 | '^.+\\.(ts|mts|mjs|js|html)$': [ 8 | '/../../build/index.js', 9 | { 10 | babelConfig: true, 11 | useESM: true, 12 | tsconfig: '/tsconfig-transpile-esm.spec.json', 13 | }, 14 | ], 15 | }, 16 | }; 17 | 18 | export default config; 19 | -------------------------------------------------------------------------------- /e2e/babel-support/tsconfig-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/babel-support/tsconfig-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "module": "ES2022", 5 | "esModuleInterop": true, 6 | "isolatedModules": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /e2e/babel-support/tsconfig-transpile-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-cjs.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/babel-support/tsconfig-transpile-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-esm.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/custom-jsdom-env/__tests__/custom-jsdom-env.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { FooComponent } from '../foo.component'; 4 | 5 | describe('FooComponent', () => { 6 | it('should trigger change detection without fixture.detectChanges', () => { 7 | TestBed.configureTestingModule({ 8 | imports: [FooComponent], 9 | }); 10 | const fixture = TestBed.createComponent(FooComponent); 11 | 12 | expect(fixture.componentInstance.value1()).toBe('val1'); 13 | 14 | fixture.componentRef.setInput('value1', 'hello'); 15 | 16 | expect(fixture.componentInstance.value1()).toBe('hello'); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /e2e/custom-jsdom-env/foo.component.html: -------------------------------------------------------------------------------- 1 | 2 |

Line 1

3 |
4 |
5 | {{ value1() }} 6 |
7 | 8 | {{ value2() }} 9 | 10 | 11 |
12 | -------------------------------------------------------------------------------- /e2e/custom-jsdom-env/foo.component.scss: -------------------------------------------------------------------------------- 1 | p { 2 | font-size: 1.6rem; 3 | } 4 | -------------------------------------------------------------------------------- /e2e/custom-jsdom-env/jest-cjs.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-custom-jsdom-env', 5 | testEnvironment: '/../../environments/jest-jsdom-env.js', 6 | setupFilesAfterEnv: ['/../setup-test-env.ts'], 7 | transform: { 8 | '^.+\\.(ts|mjs|js|html)$': [ 9 | '/../../build/index.js', 10 | { 11 | tsconfig: '/tsconfig-cjs.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 17 | }; 18 | 19 | export default config; 20 | -------------------------------------------------------------------------------- /e2e/custom-jsdom-env/jest-transpile-cjs.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-custom-jsdom-env', 5 | testEnvironment: '/../../environments/jest-jsdom-env.js', 6 | setupFilesAfterEnv: ['/../setup-test-env.ts'], 7 | transform: { 8 | '^.+\\.(ts|mjs|js|html)$': [ 9 | '/../../build/index.js', 10 | { 11 | tsconfig: '/tsconfig-transpile-cjs.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 17 | }; 18 | 19 | export default config; 20 | -------------------------------------------------------------------------------- /e2e/custom-jsdom-env/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "custom-jsdom-env", 3 | "private": true, 4 | "devDependencies": { 5 | "primeicons": "^7.0.0", 6 | "primeng": "^19.1.3" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /e2e/custom-jsdom-env/tsconfig-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/custom-jsdom-env/tsconfig-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "module": "ES2022", 5 | "esModuleInterop": true, 6 | "isolatedModules": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /e2e/custom-jsdom-env/tsconfig-transpile-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-cjs.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true, 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/custom-jsdom-env/tsconfig-transpile-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-esm.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/full-ivy-lib/jest-cjs.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-full-ivy-lib', 5 | testEnvironment: 'jsdom', 6 | setupFilesAfterEnv: ['/../setup-test-env.ts'], 7 | transform: { 8 | '^.+\\.(ts|mjs|js|html)$': [ 9 | '/../../build/index.js', 10 | { 11 | tsconfig: '/tsconfig-cjs.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 17 | }; 18 | 19 | export default config; 20 | -------------------------------------------------------------------------------- /e2e/full-ivy-lib/jest-transpile-cjs.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-full-ivy-lib', 5 | testEnvironment: 'jsdom', 6 | setupFilesAfterEnv: ['/../setup-test-env.ts'], 7 | transform: { 8 | '^.+\\.(ts|mjs|js|html)$': [ 9 | '/../../build/index.js', 10 | { 11 | tsconfig: '/tsconfig-transpile-cjs.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 17 | }; 18 | 19 | export default config; 20 | -------------------------------------------------------------------------------- /e2e/full-ivy-lib/node_modules/full-ivy/esm2020/full-ivy.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Generated bundle index. Do not edit. 3 | */ 4 | export * from './public-api'; 5 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnVsbC1pdnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9wcm9qZWN0cy9mdWxsLWl2eS9zcmMvZnVsbC1pdnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ== -------------------------------------------------------------------------------- /e2e/full-ivy-lib/node_modules/full-ivy/full-ivy.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Generated bundle index. Do not edit. 3 | */ 4 | /// 5 | export * from './public-api'; 6 | -------------------------------------------------------------------------------- /e2e/full-ivy-lib/node_modules/full-ivy/lib/full-ivy.component.d.ts: -------------------------------------------------------------------------------- 1 | import { OnInit } from '@angular/core'; 2 | import * as i0 from "@angular/core"; 3 | export declare class FullIvyComponent implements OnInit { 4 | constructor(); 5 | ngOnInit(): void; 6 | static ɵfac: i0.ɵɵFactoryDeclaration; 7 | static ɵcmp: i0.ɵɵComponentDeclaration; 8 | } 9 | -------------------------------------------------------------------------------- /e2e/full-ivy-lib/node_modules/full-ivy/lib/full-ivy.module.d.ts: -------------------------------------------------------------------------------- 1 | import * as i0 from "@angular/core"; 2 | import * as i1 from "./full-ivy.component"; 3 | export declare class FullIvyModule { 4 | static ɵfac: i0.ɵɵFactoryDeclaration; 5 | static ɵmod: i0.ɵɵNgModuleDeclaration; 6 | static ɵinj: i0.ɵɵInjectorDeclaration; 7 | } 8 | -------------------------------------------------------------------------------- /e2e/full-ivy-lib/node_modules/full-ivy/lib/full-ivy.service.d.ts: -------------------------------------------------------------------------------- 1 | import * as i0 from "@angular/core"; 2 | export declare class FullIvyService { 3 | constructor(); 4 | static ɵfac: i0.ɵɵFactoryDeclaration; 5 | static ɵprov: i0.ɵɵInjectableDeclaration; 6 | } 7 | -------------------------------------------------------------------------------- /e2e/full-ivy-lib/node_modules/full-ivy/public-api.d.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/full-ivy.service'; 2 | export * from './lib/full-ivy.component'; 3 | export * from './lib/full-ivy.module'; 4 | -------------------------------------------------------------------------------- /e2e/full-ivy-lib/tsconfig-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/full-ivy-lib/tsconfig-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "module": "ES2022", 5 | "esModuleInterop": true, 6 | "isolatedModules": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /e2e/full-ivy-lib/tsconfig-transpile-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-cjs.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/full-ivy-lib/tsconfig-transpile-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-esm.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/global-setup.ts: -------------------------------------------------------------------------------- 1 | import { existsSync } from 'node:fs'; 2 | import path from 'node:path'; 3 | 4 | import { sync as spawnSync } from 'execa'; 5 | import { sync as globSync } from 'glob'; 6 | 7 | const globalSetup = async () => { 8 | const e2eFoldersToInstallDeps = globSync('e2e/*') 9 | .map((folderPath) => path.join(process.cwd(), folderPath)) 10 | .filter((folderPath) => existsSync(path.join(folderPath, 'package.json'))); 11 | 12 | e2eFoldersToInstallDeps.forEach((folderPath) => { 13 | spawnSync('yarn', ['install'], { 14 | cwd: folderPath, 15 | }); 16 | }); 17 | }; 18 | 19 | export default globalSetup; 20 | -------------------------------------------------------------------------------- /e2e/hoisting/__test_modules__/Mocked.ts: -------------------------------------------------------------------------------- 1 | export default class Mocked { 2 | readonly isMocked: boolean; 3 | 4 | constructor() { 5 | this.isMocked = true; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /e2e/hoisting/__test_modules__/Unmocked.ts: -------------------------------------------------------------------------------- 1 | export default class Unmocked { 2 | readonly isUnmocked: boolean; 3 | 4 | constructor() { 5 | this.isUnmocked = true; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /e2e/hoisting/__test_modules__/a.ts: -------------------------------------------------------------------------------- 1 | export default (): string => 'unmocked'; 2 | -------------------------------------------------------------------------------- /e2e/hoisting/__test_modules__/b.ts: -------------------------------------------------------------------------------- 1 | export default (): string => 'unmocked'; 2 | -------------------------------------------------------------------------------- /e2e/hoisting/__test_modules__/banana.ts: -------------------------------------------------------------------------------- 1 | export = 'banana'; 2 | -------------------------------------------------------------------------------- /e2e/hoisting/__test_modules__/c.ts: -------------------------------------------------------------------------------- 1 | export default (): string => 'unmocked'; 2 | -------------------------------------------------------------------------------- /e2e/hoisting/__test_modules__/d.ts: -------------------------------------------------------------------------------- 1 | export default (): string => 'unmocked'; 2 | -------------------------------------------------------------------------------- /e2e/hoisting/__test_modules__/e.ts: -------------------------------------------------------------------------------- 1 | export default (): string => 'unmocked'; 2 | -------------------------------------------------------------------------------- /e2e/hoisting/__test_modules__/mockFile.ts: -------------------------------------------------------------------------------- 1 | jest.mock('./banana', () => { 2 | const exports = 'apple'; 3 | 4 | return exports; 5 | }); 6 | -------------------------------------------------------------------------------- /e2e/hoisting/jest-cjs.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-hoisting', 5 | transform: { 6 | '^.+\\.(ts|mjs|js|html)$': [ 7 | '/../../build/index.js', 8 | { 9 | tsconfig: '/tsconfig-cjs.spec.json', 10 | stringifyContentPathRegex: '\\.(html|svg)$', 11 | }, 12 | ], 13 | }, 14 | }; 15 | 16 | export default config; 17 | -------------------------------------------------------------------------------- /e2e/hoisting/jest-transpile-cjs.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-hoisting', 5 | testEnvironment: 'jsdom', 6 | setupFilesAfterEnv: ['/../setup-test-env.ts'], 7 | transform: { 8 | '^.+\\.(ts|mjs|js|html)$': [ 9 | '/../../build/index.js', 10 | { 11 | tsconfig: '/tsconfig-transpile-cjs.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 17 | }; 18 | 19 | export default config; 20 | -------------------------------------------------------------------------------- /e2e/hoisting/tsconfig-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/hoisting/tsconfig-transpile-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-cjs.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true, 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/ng-deep-import/__tests__/ng-deep-import.spec.ts: -------------------------------------------------------------------------------- 1 | import localeFr from '@angular/common/locales/fr'; 2 | 3 | test('should work with deep import of Angular ESM package', () => { 4 | expect(localeFr).toBeDefined(); 5 | }); 6 | -------------------------------------------------------------------------------- /e2e/ng-deep-import/jest-cjs.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-ng-deep-import', 5 | testEnvironment: 'jsdom', 6 | setupFilesAfterEnv: ['/../setup-test-env.ts'], 7 | transform: { 8 | '^.+\\.(ts|mjs|js|html)$': [ 9 | '/../../build/index.js', 10 | { 11 | tsconfig: '/tsconfig-cjs.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 17 | }; 18 | 19 | export default config; 20 | -------------------------------------------------------------------------------- /e2e/ng-deep-import/jest-transpile-cjs.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-ng-deep-import', 5 | testEnvironment: 'jsdom', 6 | setupFilesAfterEnv: ['/../setup-test-env.ts'], 7 | transform: { 8 | '^.+\\.(ts|mjs|js|html)$': [ 9 | '/../../build/index.js', 10 | { 11 | tsconfig: '/tsconfig-transpile-cjs.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 17 | }; 18 | 19 | export default config; 20 | -------------------------------------------------------------------------------- /e2e/ng-deep-import/tsconfig-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": false, 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/ng-deep-import/tsconfig-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "module": "ES2022", 5 | "esModuleInterop": true, 6 | "isolatedModules": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /e2e/ng-deep-import/tsconfig-transpile-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-cjs.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true, 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/ng-deep-import/tsconfig-transpile-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-esm.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/ng-jit-transformers/__tests__/signal-queries.spec.ts: -------------------------------------------------------------------------------- 1 | import { Component, ElementRef, viewChild } from '@angular/core'; 2 | import { TestBed } from '@angular/core/testing'; 3 | 4 | test('signal queries', () => { 5 | @Component({ 6 | selector: 'greet', 7 | standalone: true, 8 | template: '', 9 | }) 10 | class GreetCmp { 11 | input = viewChild.required('el'); 12 | } 13 | 14 | const fixture = TestBed.createComponent(GreetCmp); 15 | fixture.detectChanges(); 16 | 17 | expect(fixture.componentInstance.input()).toBeDefined(); 18 | }); 19 | -------------------------------------------------------------------------------- /e2e/ng-jit-transformers/bar.component.html: -------------------------------------------------------------------------------- 1 |

simple-with-styles works!

2 | -------------------------------------------------------------------------------- /e2e/ng-jit-transformers/bar.component.scss: -------------------------------------------------------------------------------- 1 | p { 2 | font-size: 1.6rem; 3 | } 4 | -------------------------------------------------------------------------------- /e2e/ng-jit-transformers/jest-cjs.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-ng-jit-transformers', 5 | testEnvironment: 'jsdom', 6 | setupFilesAfterEnv: ['/../setup-test-env.ts'], 7 | transform: { 8 | '^.+\\.(ts|mjs|js|html)$': [ 9 | '/../../build/index.js', 10 | { 11 | tsconfig: '/tsconfig-cjs.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 17 | }; 18 | 19 | export default config; 20 | -------------------------------------------------------------------------------- /e2e/ng-jit-transformers/jest-transpile-cjs.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-ng-jit-transformers', 5 | testEnvironment: 'jsdom', 6 | setupFilesAfterEnv: ['/../setup-test-env.ts'], 7 | transform: { 8 | '^.+\\.(ts|mjs|js|html)$': [ 9 | '/../../build/index.js', 10 | { 11 | tsconfig: '/tsconfig-transpile-cjs.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 17 | }; 18 | 19 | export default config; 20 | -------------------------------------------------------------------------------- /e2e/ng-jit-transformers/tsconfig-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/ng-jit-transformers/tsconfig-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "module": "ES2022", 5 | "esModuleInterop": true, 6 | "isolatedModules": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /e2e/ng-jit-transformers/tsconfig-transpile-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-cjs.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true, 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/ng-jit-transformers/tsconfig-transpile-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-esm.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/partial-ivy-lib/jest-cjs.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-partial-ivy-lib', 5 | testEnvironment: 'jsdom', 6 | setupFilesAfterEnv: ['/../setup-test-env.ts'], 7 | transform: { 8 | '^.+\\.(ts|mjs|js|html)$': [ 9 | '/../../build/index.js', 10 | { 11 | tsconfig: '/tsconfig-cjs.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 17 | }; 18 | 19 | export default config; 20 | -------------------------------------------------------------------------------- /e2e/partial-ivy-lib/jest-transpile-cjs.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-partial-ivy-lib', 5 | testEnvironment: 'jsdom', 6 | setupFilesAfterEnv: ['/../setup-test-env.ts'], 7 | transform: { 8 | '^.+\\.(ts|mjs|js|html)$': [ 9 | '/../../build/index.js', 10 | { 11 | tsconfig: '/tsconfig-transpile-cjs.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 17 | }; 18 | 19 | export default config; 20 | -------------------------------------------------------------------------------- /e2e/partial-ivy-lib/node_modules/partial-ivy/esm2020/partial-ivy.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Generated bundle index. Do not edit. 3 | */ 4 | export * from './public-api'; 5 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFydGlhbC1pdnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9wcm9qZWN0cy9wYXJ0aWFsLWl2eS9zcmMvcGFydGlhbC1pdnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ== -------------------------------------------------------------------------------- /e2e/partial-ivy-lib/node_modules/partial-ivy/esm2020/testing/partial-ivy-testing.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Generated bundle index. Do not edit. 3 | */ 4 | export * from './index'; 5 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFydGlhbC1pdnktdGVzdGluZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL3BhcnRpYWwtaXZ5L3Rlc3Rpbmcvc3JjL3BhcnRpYWwtaXZ5LXRlc3RpbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLFNBQVMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9pbmRleCc7XG4iXX0= -------------------------------------------------------------------------------- /e2e/partial-ivy-lib/node_modules/partial-ivy/fesm2015/partial-ivy-testing.mjs.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"partial-ivy-testing.mjs","sources":["../../../projects/partial-ivy/testing/src/index.ts","../../../projects/partial-ivy/testing/src/partial-ivy-testing.ts"],"sourcesContent":["import { NgModule } from \"@angular/core\";\n\n@NgModule()\nexport class PartialIvyTestingModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAGa,uBAAuB;;oHAAvB,uBAAuB;qHAAvB,uBAAuB;qHAAvB,uBAAuB;2FAAvB,uBAAuB;kBADnC,QAAQ;;;ACFT;;;;;;"} -------------------------------------------------------------------------------- /e2e/partial-ivy-lib/node_modules/partial-ivy/fesm2020/partial-ivy-testing.mjs.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"partial-ivy-testing.mjs","sources":["../../../projects/partial-ivy/testing/src/index.ts","../../../projects/partial-ivy/testing/src/partial-ivy-testing.ts"],"sourcesContent":["import { NgModule } from \"@angular/core\";\n\n@NgModule()\nexport class PartialIvyTestingModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAGa,uBAAuB;;oHAAvB,uBAAuB;qHAAvB,uBAAuB;qHAAvB,uBAAuB;2FAAvB,uBAAuB;kBADnC,QAAQ;;;ACFT;;;;;;"} -------------------------------------------------------------------------------- /e2e/partial-ivy-lib/node_modules/partial-ivy/lib/partial-ivy.component.d.ts: -------------------------------------------------------------------------------- 1 | import { OnInit } from '@angular/core'; 2 | import * as i0 from "@angular/core"; 3 | export declare class PartialIvyComponent implements OnInit { 4 | constructor(); 5 | ngOnInit(): void; 6 | static ɵfac: i0.ɵɵFactoryDeclaration; 7 | static ɵcmp: i0.ɵɵComponentDeclaration; 8 | } 9 | -------------------------------------------------------------------------------- /e2e/partial-ivy-lib/node_modules/partial-ivy/lib/partial-ivy.module.d.ts: -------------------------------------------------------------------------------- 1 | import * as i0 from "@angular/core"; 2 | import * as i1 from "./partial-ivy.component"; 3 | export declare class PartialIvyModule { 4 | static ɵfac: i0.ɵɵFactoryDeclaration; 5 | static ɵmod: i0.ɵɵNgModuleDeclaration; 6 | static ɵinj: i0.ɵɵInjectorDeclaration; 7 | } 8 | -------------------------------------------------------------------------------- /e2e/partial-ivy-lib/node_modules/partial-ivy/lib/partial-ivy.service.d.ts: -------------------------------------------------------------------------------- 1 | import * as i0 from "@angular/core"; 2 | export declare class PartialIvyService { 3 | constructor(); 4 | static ɵfac: i0.ɵɵFactoryDeclaration; 5 | static ɵprov: i0.ɵɵInjectableDeclaration; 6 | } 7 | -------------------------------------------------------------------------------- /e2e/partial-ivy-lib/node_modules/partial-ivy/partial-ivy.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Generated bundle index. Do not edit. 3 | */ 4 | /// 5 | export * from './public-api'; 6 | -------------------------------------------------------------------------------- /e2e/partial-ivy-lib/node_modules/partial-ivy/public-api.d.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/partial-ivy.service'; 2 | export * from './lib/partial-ivy.component'; 3 | export * from './lib/partial-ivy.module'; 4 | -------------------------------------------------------------------------------- /e2e/partial-ivy-lib/node_modules/partial-ivy/testing/index.d.ts: -------------------------------------------------------------------------------- 1 | import * as i0 from "@angular/core"; 2 | export declare class PartialIvyTestingModule { 3 | static ɵfac: i0.ɵɵFactoryDeclaration; 4 | static ɵmod: i0.ɵɵNgModuleDeclaration; 5 | static ɵinj: i0.ɵɵInjectorDeclaration; 6 | } 7 | -------------------------------------------------------------------------------- /e2e/partial-ivy-lib/node_modules/partial-ivy/testing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "module": "../fesm2015/partial-ivy-testing.mjs", 3 | "es2020": "../fesm2020/partial-ivy-testing.mjs", 4 | "esm2020": "../esm2020/testing/partial-ivy-testing.mjs", 5 | "fesm2020": "../fesm2020/partial-ivy-testing.mjs", 6 | "fesm2015": "../fesm2015/partial-ivy-testing.mjs", 7 | "typings": "partial-ivy-testing.d.ts", 8 | "sideEffects": false, 9 | "name": "partial-ivy/testing" 10 | } -------------------------------------------------------------------------------- /e2e/partial-ivy-lib/node_modules/partial-ivy/testing/partial-ivy-testing.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Generated bundle index. Do not edit. 3 | */ 4 | /// 5 | export * from './index'; 6 | -------------------------------------------------------------------------------- /e2e/partial-ivy-lib/tsconfig-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/partial-ivy-lib/tsconfig-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "module": "ES2022", 5 | "esModuleInterop": true, 6 | "isolatedModules": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /e2e/partial-ivy-lib/tsconfig-transpile-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-cjs.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true, 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/partial-ivy-lib/tsconfig-transpile-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-esm.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/process-js-packages/__tests__/process-js-packages.spec.ts: -------------------------------------------------------------------------------- 1 | import camelCase from 'lodash-es/camelCase'; 2 | import { union } from 'set-utilities'; 3 | import { __assign } from 'tslib'; 4 | 5 | test('should pass', () => { 6 | expect(camelCase('foo-bar')).toBe('fooBar'); 7 | expect(typeof __assign).toBe('function'); 8 | expect(union(new Set([1, 2, 3]), new Set([4, 5, 6]))).toStrictEqual(new Set([1, 2, 3, 4, 5, 6])); 9 | }); 10 | -------------------------------------------------------------------------------- /e2e/process-js-packages/jest-cjs.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-process-js-packages', 5 | globals: { 6 | ngJest: { 7 | processWithEsbuild: ['**/node_modules/lodash-es/*.js'], 8 | }, 9 | }, 10 | transform: { 11 | '^.+\\.(ts|js|mjs|html)$': [ 12 | '/../../build/index.js', 13 | { 14 | tsconfig: '/tsconfig-cjs.spec.json', 15 | stringifyContentPathRegex: '\\.(html|svg)$', 16 | }, 17 | ], 18 | }, 19 | transformIgnorePatterns: ['node_modules/(?!lodash-es|set-utilities)'], 20 | }; 21 | 22 | export default config; 23 | -------------------------------------------------------------------------------- /e2e/process-js-packages/jest-esm.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-process-js-packages', 5 | globals: { 6 | ngJest: { 7 | processWithEsbuild: ['**/node_modules/lodash-es/*.js'], 8 | }, 9 | }, 10 | extensionsToTreatAsEsm: ['.ts', '.mts'], 11 | transform: { 12 | '^.+\\.(ts|mts|js|mjs|html)$': [ 13 | '/../../build/index.js', 14 | { 15 | useESM: true, 16 | tsconfig: '/tsconfig-esm.spec.json', 17 | }, 18 | ], 19 | }, 20 | }; 21 | 22 | export default config; 23 | -------------------------------------------------------------------------------- /e2e/process-js-packages/jest-transpile-esm.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | displayName: 'e2e-process-js-packages', 5 | globals: { 6 | ngJest: { 7 | processWithEsbuild: ['**/node_modules/lodash-es/*.js'], 8 | }, 9 | }, 10 | extensionsToTreatAsEsm: ['.ts', '.mts'], 11 | transform: { 12 | '^.+\\.(ts|mts|js|mjs|html)$': [ 13 | '/../../build/index.js', 14 | { 15 | useESM: true, 16 | tsconfig: '/tsconfig-transpile-esm.spec.json', 17 | }, 18 | ], 19 | }, 20 | }; 21 | 22 | export default config; 23 | -------------------------------------------------------------------------------- /e2e/process-js-packages/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "process-js-packages", 3 | "private": true, 4 | "devDependencies": { 5 | "@types/lodash-es": "^4.17.12", 6 | "lodash-es": "^4.17.21", 7 | "set-utilities": "^1.5.7" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /e2e/process-js-packages/tsconfig-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/process-js-packages/tsconfig-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "module": "ES2022", 5 | "esModuleInterop": true, 6 | "isolatedModules": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /e2e/process-js-packages/tsconfig-transpile-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-cjs.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true, 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/process-js-packages/tsconfig-transpile-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-esm.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/setup-test-env.mts: -------------------------------------------------------------------------------- 1 | import { setupZoneTestEnv } from '../setup-env/zone/index.mjs'; 2 | 3 | setupZoneTestEnv(); 4 | -------------------------------------------------------------------------------- /e2e/setup-test-env.ts: -------------------------------------------------------------------------------- 1 | import { setupZoneTestEnv } from '../setup-env/zone'; 2 | 3 | setupZoneTestEnv(); 4 | -------------------------------------------------------------------------------- /e2e/snapshot-serializers/foo.component.html: -------------------------------------------------------------------------------- 1 | 2 |

Line 1

3 |
4 |
5 | {{ value1() }} 6 |
7 | 8 | {{ value2() }} 9 | 10 |
11 | -------------------------------------------------------------------------------- /e2e/snapshot-serializers/foo.component.scss: -------------------------------------------------------------------------------- 1 | p { 2 | font-size: 1.6rem; 3 | } 4 | -------------------------------------------------------------------------------- /e2e/snapshot-serializers/tsconfig-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/snapshot-serializers/tsconfig-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "module": "ES2022", 5 | "esModuleInterop": true, 6 | "isolatedModules": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /e2e/snapshot-serializers/tsconfig-transpile-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-cjs.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true, 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/snapshot-serializers/tsconfig-transpile-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-esm.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/zoneless-env/__tests__/zoneless-env.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { FooComponent } from '../foo.component'; 4 | 5 | describe('FooComponent', () => { 6 | it('should trigger change detection without fixture.detectChanges', () => { 7 | TestBed.configureTestingModule({ 8 | imports: [FooComponent], 9 | }); 10 | const fixture = TestBed.createComponent(FooComponent); 11 | 12 | expect(fixture.componentInstance.value1()).toBe('val1'); 13 | 14 | fixture.componentRef.setInput('value1', 'hello'); 15 | 16 | expect(fixture.componentInstance.value1()).toBe('hello'); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /e2e/zoneless-env/foo.component.html: -------------------------------------------------------------------------------- 1 | 2 |

Line 1

3 |
4 |
5 | {{ value1() }} 6 |
7 | 8 | {{ value2() }} 9 | 10 |
11 | -------------------------------------------------------------------------------- /e2e/zoneless-env/foo.component.scss: -------------------------------------------------------------------------------- 1 | p { 2 | font-size: 1.6rem; 3 | } 4 | -------------------------------------------------------------------------------- /e2e/zoneless-env/setup-zoneless-env.mts: -------------------------------------------------------------------------------- 1 | import { setupZonelessTestEnv } from '../../setup-env/zoneless/index.mjs'; 2 | 3 | setupZonelessTestEnv(); 4 | -------------------------------------------------------------------------------- /e2e/zoneless-env/setup-zoneless-env.ts: -------------------------------------------------------------------------------- 1 | import { setupZonelessTestEnv } from '../../setup-env/zoneless'; 2 | 3 | setupZonelessTestEnv(); 4 | -------------------------------------------------------------------------------- /e2e/zoneless-env/tsconfig-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/zoneless-env/tsconfig-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.spec.json", 3 | "compilerOptions": { 4 | "module": "ES2022", 5 | "esModuleInterop": true, 6 | "isolatedModules": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /e2e/zoneless-env/tsconfig-transpile-cjs.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-cjs.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true, 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /e2e/zoneless-env/tsconfig-transpile-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-esm.spec.json", 3 | "compilerOptions": { 4 | "isolatedModules": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /environments/jest-jsdom-env.d.ts: -------------------------------------------------------------------------------- 1 | import type { EnvironmentContext, JestEnvironmentConfig } from '@jest/environment'; 2 | 3 | import BaseEnv from '../build/environments/jest-env-jsdom-abstract'; 4 | 5 | export default class JestJSDOMEnvironment extends BaseEnv { 6 | constructor(config: JestEnvironmentConfig, context: EnvironmentContext); 7 | } 8 | -------------------------------------------------------------------------------- /environments/jest-jsdom-env.js: -------------------------------------------------------------------------------- 1 | const jestJsdomEnv = require('../build/environments/jest-jsdom-env'); 2 | 3 | module.exports = jestJsdomEnv; 4 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/jest-esm-isolated.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | import jestCfg from './jest-esm.config'; 4 | 5 | export default { 6 | ...jestCfg, 7 | transform: { 8 | '^.+\\.(ts|js|html|svg)$': [ 9 | 'jest-preset-angular', 10 | { 11 | tsconfig: '/tsconfig-isolated-esm.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | useESM: true, 14 | }, 15 | ], 16 | }, 17 | } satisfies JestConfigWithTsJest; 18 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/jest-isolated.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'jest'; 2 | import { createCjsPreset } from 'jest-preset-angular/presets'; 3 | 4 | import jestCfg from './jest.config'; 5 | 6 | export default { 7 | ...jestCfg, 8 | ...createCjsPreset({ 9 | tsconfig: '/tsconfig-isolated.spec.json', 10 | }), 11 | } satisfies Config; 12 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/jest.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'jest'; 2 | import { createCjsPreset } from 'jest-preset-angular/presets'; 3 | import { pathsToModuleNameMapper } from 'ts-jest'; 4 | 5 | import { compilerOptions } from './tsconfig.json'; 6 | 7 | export default { 8 | displayName: 'app1', 9 | ...createCjsPreset(), 10 | setupFilesAfterEnv: ['/setup-jest.ts'], 11 | moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '' }), 12 | } satisfies Config; 13 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/setup-jest-esm.ts: -------------------------------------------------------------------------------- 1 | import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs'; 2 | import './jest-global-mocks'; 3 | 4 | setupZoneTestEnv(); 5 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/setup-jest.ts: -------------------------------------------------------------------------------- 1 | import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'; 2 | import './jest-global-mocks'; 3 | 4 | setupZoneTestEnv(); 5 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/about/about.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HighlightDirective } from '@shared/highlight.directive'; 3 | 4 | import { TwainComponent } from '../twain/twain.component'; 5 | 6 | @Component({ 7 | standalone: true, 8 | template: ` 9 |

About

10 |

Quote of the day:

11 | 12 | `, 13 | imports: [TwainComponent, HighlightDirective], 14 | }) 15 | export class AboutComponent {} 16 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/app-initial.component.ts: -------------------------------------------------------------------------------- 1 | // Reduced version of the initial AppComponent generated by CLI 2 | import { Component } from '@angular/core'; 3 | 4 | @Component({ 5 | standalone: true, 6 | selector: 'app-root', 7 | template: '

Welcome to {{title}}!

', 8 | }) 9 | export class AppComponent { 10 | title = 'app'; 11 | } 12 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { DOCUMENT } from '@angular/common'; 2 | import { Component, Inject } from '@angular/core'; 3 | import { RouterLink, RouterOutlet } from '@angular/router'; 4 | 5 | import { BannerComponent } from './banner/banner.component'; 6 | import { WelcomeComponent } from './welcome/welcome.component'; 7 | 8 | @Component({ 9 | standalone: true, 10 | selector: 'app-root', 11 | templateUrl: './app.component.html', 12 | imports: [BannerComponent, WelcomeComponent, RouterOutlet, RouterLink], 13 | }) 14 | export class AppComponent { 15 | constructor(@Inject(DOCUMENT) injectedDoc: Document) { 16 | injectedDoc.title = 'Example App'; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/app.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | 3 | import { AboutComponent } from './about/about.component'; 4 | import { DashboardComponent } from './dashboard/dashboard.component'; 5 | 6 | export const routes: Routes = [ 7 | { path: '', redirectTo: 'dashboard', pathMatch: 'full' }, 8 | { path: 'about', component: AboutComponent }, 9 | { path: 'dashboard', component: DashboardComponent }, 10 | { path: 'heroes', loadChildren: () => import('./hero/hero.routes') }, 11 | ]; 12 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/banner/banner-external.component.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: green; 3 | font-size: 350%; 4 | } 5 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/banner/banner-external.component.html: -------------------------------------------------------------------------------- 1 |

{{ title }}

2 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/banner/banner-external.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | standalone: true, 5 | selector: 'app-banner', 6 | templateUrl: './banner-external.component.html', 7 | styleUrls: ['./banner-external.component.css'], 8 | }) 9 | export class BannerComponent { 10 | title = 'Test Tour of Heroes'; 11 | } 12 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/banner/banner-initial.component.ts: -------------------------------------------------------------------------------- 1 | // BannerComponent as initially generated by the CLI 2 | import { Component } from '@angular/core'; 3 | 4 | @Component({ 5 | standalone: true, 6 | selector: 'app-banner', 7 | template: '

banner works!

', 8 | styles: [], 9 | }) 10 | export class BannerComponent {} 11 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/banner/banner.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | standalone: true, 5 | selector: 'app-banner', 6 | template: '

{{title}}

', 7 | styles: ['h1 { color: green; font-size: 350%}'], 8 | }) 9 | export class BannerComponent { 10 | title = 'Test Tour of Heroes'; 11 | } 12 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/dashboard/dashboard-hero.component.css: -------------------------------------------------------------------------------- 1 | .hero { 2 | padding: 20px; 3 | position: relative; 4 | text-align: center; 5 | color: #eee; 6 | max-height: 120px; 7 | width: 100%; 8 | min-width: 120px; 9 | background-color: #607d8b; 10 | border-radius: 2px; 11 | } 12 | 13 | .hero:hover { 14 | background-color: #eee; 15 | cursor: pointer; 16 | color: #607d8b; 17 | } 18 | 19 | @media (max-width: 600px) { 20 | .hero { 21 | font-size: 10px; 22 | max-height: 75px; 23 | } 24 | } 25 | 26 | @media (max-width: 1024px) { 27 | .hero { 28 | min-width: 60px; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/dashboard/dashboard.component.css: -------------------------------------------------------------------------------- 1 | [class*='col-'] { 2 | float: left; 3 | } 4 | *, 5 | *::after, 6 | *::before { 7 | box-sizing: border-box; 8 | } 9 | h3 { 10 | text-align: center; 11 | margin-bottom: 0; 12 | } 13 | [class*='col-'] { 14 | padding-right: 20px; 15 | padding-bottom: 20px; 16 | } 17 | [class*='col-']:last-of-type { 18 | padding-right: 0; 19 | } 20 | .grid { 21 | margin: 0; 22 | } 23 | .col-1-4 { 24 | width: 25%; 25 | } 26 | .grid-pad { 27 | padding: 10px 0; 28 | } 29 | .grid-pad > [class*='col-']:last-of-type { 30 | padding-right: 20px; 31 | } 32 | @media (max-width: 1024px) { 33 | .grid { 34 | margin: 0; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/dashboard/dashboard.component.html: -------------------------------------------------------------------------------- 1 |

{{ title }}

2 | 3 |
4 | 10 | 11 |
12 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/demo/demo-external-template.html: -------------------------------------------------------------------------------- 1 | from external template 2 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/demo/demo-main.ts: -------------------------------------------------------------------------------- 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 2 | 3 | import { demoProviders } from './demo'; 4 | 5 | platformBrowserDynamic([demoProviders]); 6 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/hero/hero-detail.component.css: -------------------------------------------------------------------------------- 1 | label { 2 | display: inline-block; 3 | width: 3em; 4 | margin: 0.5em 0; 5 | color: #607d8b; 6 | font-weight: bold; 7 | } 8 | input { 9 | height: 2em; 10 | font-size: 1em; 11 | padding-left: 0.4em; 12 | } 13 | button { 14 | margin-top: 20px; 15 | font-family: Arial, sans-serif; 16 | background-color: #eee; 17 | border: none; 18 | padding: 5px 10px; 19 | border-radius: 4px; 20 | cursor: pointer; 21 | } 22 | button:hover { 23 | background-color: #cfd8dc; 24 | } 25 | button:disabled { 26 | background-color: #eee; 27 | color: #ccc; 28 | cursor: auto; 29 | } 30 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/hero/hero-detail.component.html: -------------------------------------------------------------------------------- 1 |
2 |

3 | {{ hero.name | titlecase }} Details 4 |

5 |
id: {{ hero.id }}
6 |
7 | 8 | 13 |
14 | 20 | 26 |
27 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/hero/hero-list.component.html: -------------------------------------------------------------------------------- 1 |

My Heroes

2 |
    3 |
  • 4 | 12 |
  • 13 |
14 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/hero/hero.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | 3 | import { HeroDetailComponent } from './hero-detail.component'; 4 | import { HeroListComponent } from './hero-list.component'; 5 | 6 | export default [ 7 | { path: '', component: HeroListComponent }, 8 | { path: ':id', component: HeroDetailComponent }, 9 | ] as Routes; 10 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/model/hero.ts: -------------------------------------------------------------------------------- 1 | export interface Hero { 2 | id: number; 3 | name: string; 4 | } 5 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/model/index.ts: -------------------------------------------------------------------------------- 1 | export * from './hero'; 2 | export * from './hero.service'; 3 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/model/testing/index.ts: -------------------------------------------------------------------------------- 1 | export * from './test-hero.service'; 2 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/model/testing/test-heroes.ts: -------------------------------------------------------------------------------- 1 | import { Hero } from '../hero'; 2 | 3 | export function getTestHeroes(): Hero[] { 4 | return [ 5 | { id: 41, name: 'Bob' }, 6 | { id: 42, name: 'Carol' }, 7 | { id: 43, name: 'Ted' }, 8 | { id: 44, name: 'Alice' }, 9 | { id: 45, name: 'Speedy' }, 10 | { id: 46, name: 'Stealthy' }, 11 | ]; 12 | } 13 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/shared/app.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { AppService } from './app.service'; 4 | import { REQUEST } from './app.tokens'; 5 | 6 | describe('AppService', () => { 7 | let service: AppService; 8 | 9 | beforeEach(() => { 10 | TestBed.configureTestingModule({ 11 | providers: [ 12 | { 13 | provide: REQUEST, 14 | useValue: {}, 15 | }, 16 | ], 17 | }); 18 | service = TestBed.inject(AppService); 19 | }); 20 | 21 | it('should be created', () => { 22 | expect(service).toBeTruthy(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/shared/app.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable, inject } from '@angular/core'; 2 | 3 | import { REQUEST } from './app.tokens'; 4 | 5 | @Injectable({ 6 | providedIn: 'root', 7 | }) 8 | export class AppService { 9 | private readonly request = inject(REQUEST); 10 | } 11 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/shared/app.tokens.ts: -------------------------------------------------------------------------------- 1 | import { InjectionToken } from '@angular/core'; 2 | import type { Request } from 'express'; 3 | 4 | export const REQUEST = new InjectionToken('express-request'); 5 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/shared/highlight.directive.ts: -------------------------------------------------------------------------------- 1 | import { Directive, ElementRef, Input, OnChanges } from '@angular/core'; 2 | 3 | @Directive({ standalone: true, selector: '[highlight]' }) 4 | export class HighlightDirective implements OnChanges { 5 | defaultColor = 'rgb(211, 211, 211)'; // lightgray 6 | 7 | @Input('highlight') bgColor = ''; 8 | 9 | constructor(private readonly el: ElementRef) { 10 | el.nativeElement.style.customProperty = true; 11 | } 12 | 13 | ngOnChanges() { 14 | this.el.nativeElement.style.backgroundColor = this.bgColor || this.defaultColor; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/shared/shared.ts: -------------------------------------------------------------------------------- 1 | import { NgFor, NgIf } from '@angular/common'; 2 | import { FormsModule } from '@angular/forms'; 3 | 4 | import * as Services from './app.service'; 5 | import { HighlightDirective } from './highlight.directive'; 6 | import { TitleCasePipe } from './title-case.pipe'; 7 | 8 | const sharedImports = [FormsModule, HighlightDirective, TitleCasePipe, NgIf, NgFor]; 9 | 10 | export { Services, sharedImports, HighlightDirective, TitleCasePipe }; 11 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/shared/title-case.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | 3 | @Pipe({ name: 'titlecase', standalone: true, pure: true }) 4 | export class TitleCasePipe implements PipeTransform { 5 | transform(input: string): string { 6 | return input.length === 0 7 | ? '' 8 | : input.replace(/\w\S*/g, (txt) => txt[0].toUpperCase() + txt.slice(1).toLowerCase()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/twain/quote.ts: -------------------------------------------------------------------------------- 1 | export interface Quote { 2 | id: number; 3 | quote: string; 4 | } 5 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/app/welcome/welcome.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { UserService } from 'libs/user/src/lib/user.service'; 3 | 4 | @Component({ 5 | standalone: true, 6 | selector: 'app-welcome', 7 | template: '

{{welcome}}

', 8 | }) 9 | export class WelcomeComponent implements OnInit { 10 | welcome = ''; 11 | constructor(private readonly userService: UserService) {} 12 | 13 | ngOnInit(): void { 14 | this.welcome = this.userService.isLoggedIn ? 'Welcome, ' + this.userService.user.name : 'Please log in.'; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | App Under Test 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/main.ts: -------------------------------------------------------------------------------- 1 | import { bootstrapApplication } from '@angular/platform-browser'; 2 | 3 | import { AppComponent } from './app/app.component'; 4 | import { appConfig } from './app/app.config'; 5 | 6 | bootstrapApplication(AppComponent, appConfig).catch((err) => console.error(err)); 7 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/src/testing/index.ts: -------------------------------------------------------------------------------- 1 | import { DebugElement } from '@angular/core'; 2 | 3 | export * from './async-observable-helpers'; 4 | 5 | interface IButtonClickEvent { 6 | button: number; 7 | } 8 | 9 | export const ButtonClickEvents: { 10 | left: IButtonClickEvent; 11 | right: IButtonClickEvent; 12 | } = { 13 | left: { button: 0 }, 14 | right: { button: 2 }, 15 | }; 16 | 17 | export function click(el: DebugElement | HTMLElement, eventObj: IButtonClickEvent = ButtonClickEvents.left): void { 18 | if (el instanceof HTMLElement) { 19 | el.click(); 20 | } else { 21 | el.triggerEventHandler('click', eventObj); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/tsconfig-esm.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.spec.json", 4 | "compilerOptions": { 5 | "module": "ES2020", 6 | "isolatedModules": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/tsconfig-isolated-esm.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig-esm.spec.json", 4 | "compilerOptions": { 5 | "isolatedModules": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/tsconfig-isolated.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.spec.json", 4 | "compilerOptions": { 5 | "isolatedModules": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/app" 5 | }, 6 | "files": [ 7 | "src/main.ts" 8 | ], 9 | "include": [ 10 | "src/**/*.d.ts" 11 | ], 12 | "exclude": [ 13 | "src/**/*.spec.ts", 14 | "src/testing" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "paths": { 6 | "@shared/*": ["src/app/shared/*"], 7 | "libs/*": ["../../libs/*"] 8 | } 9 | }, 10 | "angularCompilerOptions": { 11 | "enableI18nLegacyMessageIdFormat": false, 12 | "strictInjectionParameters": true, 13 | "strictInputAccessModifiers": true, 14 | "strictTemplates": true 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/apps/app1/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "module": "CommonJS", 6 | "isolatedModules": false, 7 | "types": [ 8 | "jest" 9 | ] 10 | }, 11 | "include": [ 12 | "**/*.spec.ts", 13 | "**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/jest-esm-isolated.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | export default { 4 | projects: ['/apps/app1/jest-esm-isolated.config.ts', '/libs/user/jest-esm-isolated.config.ts'], 5 | } satisfies JestConfigWithTsJest; 6 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/jest-esm.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | export default { 4 | projects: ['/apps/app1/jest-esm.config.ts', '/libs/user/jest-esm.config.ts'], 5 | } satisfies JestConfigWithTsJest; 6 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/jest-isolated.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | export default { 4 | projects: ['/apps/app1/jest-isolated.config.ts', '/libs/user/jest-isolated.config.ts'], 5 | } satisfies JestConfigWithTsJest; 6 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/jest.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | export default { 4 | projects: ['/apps/app1', '/libs/user'], 5 | } satisfies JestConfigWithTsJest; 6 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/libs/user/jest-esm-isolated.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | import jestCfg from './jest-esm.config'; 4 | 5 | export default { 6 | ...jestCfg, 7 | transform: { 8 | '^.+\\.(ts|js|html|svg)$': [ 9 | 'jest-preset-angular', 10 | { 11 | tsconfig: '/tsconfig-isolated-esm.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | useESM: true, 14 | }, 15 | ], 16 | }, 17 | } satisfies JestConfigWithTsJest; 18 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/libs/user/jest-isolated.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'jest'; 2 | import { createCjsPreset } from 'jest-preset-angular/presets'; 3 | 4 | import jestCfg from './jest.config'; 5 | 6 | export default { 7 | ...jestCfg, 8 | ...createCjsPreset({ 9 | tsconfig: '/tsconfig-isolated.spec.json', 10 | }), 11 | } satisfies Config; 12 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/libs/user/jest.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'jest'; 2 | import { createCjsPreset } from 'jest-preset-angular/presets'; 3 | 4 | export default { 5 | displayName: 'user-lib', 6 | ...createCjsPreset(), 7 | setupFilesAfterEnv: ['/setup-jest.ts'], 8 | } satisfies Config; 9 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/libs/user/ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", 3 | "dest": "../../dist/user", 4 | "lib": { 5 | "entryFile": "src/public-api.ts" 6 | } 7 | } -------------------------------------------------------------------------------- /examples/example-app-monorepo/libs/user/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "user", 3 | "version": "0.0.1", 4 | "peerDependencies": { 5 | "@angular/common": "^20.0.0", 6 | "@angular/core": "^20.0.0" 7 | }, 8 | "dependencies": { 9 | "tslib": "^2.8.1" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/libs/user/setup-jest-esm.ts: -------------------------------------------------------------------------------- 1 | import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs'; 2 | import './jest-global-mocks'; 3 | 4 | setupZoneTestEnv(); 5 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/libs/user/setup-jest.ts: -------------------------------------------------------------------------------- 1 | import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'; 2 | import './jest-global-mocks'; 3 | 4 | setupZoneTestEnv(); 5 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/libs/user/src/lib/user.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { describe, beforeEach, test } from '@jest/globals'; 3 | 4 | import { UserService } from './user.service'; 5 | 6 | describe('UserService', () => { 7 | let service: UserService; 8 | 9 | beforeEach(() => { 10 | TestBed.configureTestingModule({ 11 | providers: [UserService], 12 | }); 13 | service = TestBed.inject(UserService); 14 | }); 15 | 16 | test('should be created', () => { 17 | expect(service.isLoggedIn).toBe(true); 18 | expect(service.user).toEqual({ name: 'Sam Spade' }); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/libs/user/src/lib/user.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable() 4 | export class UserService { 5 | isLoggedIn = true; 6 | user = { name: 'Sam Spade' }; 7 | } 8 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/libs/user/src/public-api.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Public API Surface of user 3 | */ 4 | 5 | export * from './lib/user.service'; 6 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/libs/user/tsconfig-esm.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.spec.json", 4 | "compilerOptions": { 5 | "module": "ES2020", 6 | "isolatedModules": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/libs/user/tsconfig-isolated-esm.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig-esm.spec.json", 4 | "compilerOptions": { 5 | "isolatedModules": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/libs/user/tsconfig-isolated.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.spec.json", 4 | "compilerOptions": { 5 | "isolatedModules": true, 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/libs/user/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../../tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "../../out-tsc/lib", 6 | "declaration": true, 7 | "declarationMap": true, 8 | "inlineSources": true, 9 | "types": [] 10 | }, 11 | "exclude": [ 12 | "src/test.ts", 13 | "**/*.spec.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/libs/user/tsconfig.lib.prod.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.lib.json", 4 | "compilerOptions": { 5 | "declarationMap": false 6 | }, 7 | "angularCompilerOptions": { 8 | "compilationMode": "partial" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/example-app-monorepo/libs/user/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../../tsconfig.json", 4 | "compilerOptions": { 5 | "module": "CommonJS", 6 | "isolatedModules": false, 7 | "types": [ 8 | "jest" 9 | ] 10 | }, 11 | "include": [ 12 | "**/*.spec.ts", 13 | "**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /examples/example-app-v18/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /examples/example-app-v18/jest-esm-isolated.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | import jestCfg from './jest-esm.config'; 4 | 5 | export default { 6 | ...jestCfg, 7 | transform: { 8 | '^.+\\.(ts|js|html|svg)$': [ 9 | 'jest-preset-angular', 10 | { 11 | tsconfig: '/tsconfig-isolated-esm.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | useESM: true, 14 | }, 15 | ], 16 | }, 17 | } satisfies JestConfigWithTsJest; 18 | -------------------------------------------------------------------------------- /examples/example-app-v18/jest-isolated.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'jest'; 2 | import { createCjsPreset } from 'jest-preset-angular/presets'; 3 | 4 | import jestCfg from './jest.config'; 5 | 6 | export default { 7 | ...jestCfg, 8 | ...createCjsPreset({ 9 | tsconfig: '/tsconfig-isolated.spec.json', 10 | }), 11 | } satisfies Config; 12 | -------------------------------------------------------------------------------- /examples/example-app-v18/jest.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'jest'; 2 | import { createCjsPreset } from 'jest-preset-angular/presets'; 3 | import { pathsToModuleNameMapper } from 'ts-jest'; 4 | 5 | import { compilerOptions } from './tsconfig.json'; 6 | 7 | export default { 8 | ...createCjsPreset(), 9 | moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '' }), 10 | setupFilesAfterEnv: ['/setup-jest.ts'], 11 | } satisfies Config; 12 | -------------------------------------------------------------------------------- /examples/example-app-v18/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thymikee/jest-preset-angular/eefc72b40103a6e4156975df1f6f366f69af0172/examples/example-app-v18/public/favicon.ico -------------------------------------------------------------------------------- /examples/example-app-v18/setup-jest-esm.ts: -------------------------------------------------------------------------------- 1 | import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs'; 2 | import './jest-global-mocks'; 3 | 4 | setupZoneTestEnv(); 5 | -------------------------------------------------------------------------------- /examples/example-app-v18/setup-jest.ts: -------------------------------------------------------------------------------- 1 | import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'; 2 | import './jest-global-mocks'; 3 | 4 | setupZoneTestEnv(); 5 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/about/about.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HighlightDirective } from '@shared/highlight.directive'; 3 | 4 | import { TwainComponent } from '../twain/twain.component'; 5 | 6 | @Component({ 7 | standalone: true, 8 | template: ` 9 |

About

10 |

Quote of the day:

11 | 12 | `, 13 | imports: [TwainComponent, HighlightDirective], 14 | }) 15 | export class AboutComponent {} 16 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/app-initial.component.ts: -------------------------------------------------------------------------------- 1 | // Reduced version of the initial AppComponent generated by CLI 2 | import { Component } from '@angular/core'; 3 | 4 | @Component({ 5 | standalone: true, 6 | selector: 'app-root', 7 | template: '

Welcome to {{title}}!

', 8 | }) 9 | export class AppComponent { 10 | title = 'app'; 11 | } 12 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { DOCUMENT } from '@angular/common'; 2 | import { Component, Inject } from '@angular/core'; 3 | import { RouterLink, RouterOutlet } from '@angular/router'; 4 | 5 | import { BannerComponent } from './banner/banner.component'; 6 | import { WelcomeComponent } from './welcome/welcome.component'; 7 | 8 | @Component({ 9 | standalone: true, 10 | selector: 'app-root', 11 | templateUrl: './app.component.html', 12 | imports: [BannerComponent, WelcomeComponent, RouterOutlet, RouterLink], 13 | }) 14 | export class AppComponent { 15 | constructor(@Inject(DOCUMENT) injectedDoc: Document) { 16 | injectedDoc.title = 'Example App'; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/app.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | 3 | import { AboutComponent } from './about/about.component'; 4 | import { DashboardComponent } from './dashboard/dashboard.component'; 5 | 6 | export const routes: Routes = [ 7 | { path: '', redirectTo: 'dashboard', pathMatch: 'full' }, 8 | { path: 'about', component: AboutComponent }, 9 | { path: 'dashboard', component: DashboardComponent }, 10 | { path: 'heroes', loadChildren: () => import('./hero/hero.routes') }, 11 | ]; 12 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/banner/banner-external.component.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: green; 3 | font-size: 350%; 4 | } 5 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/banner/banner-external.component.html: -------------------------------------------------------------------------------- 1 |

{{ title }}

2 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/banner/banner-external.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | standalone: true, 5 | selector: 'app-banner', 6 | templateUrl: './banner-external.component.html', 7 | styleUrls: ['./banner-external.component.css'], 8 | }) 9 | export class BannerComponent { 10 | title = 'Test Tour of Heroes'; 11 | } 12 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/banner/banner-initial.component.ts: -------------------------------------------------------------------------------- 1 | // BannerComponent as initially generated by the CLI 2 | import { Component } from '@angular/core'; 3 | 4 | @Component({ 5 | standalone: true, 6 | selector: 'app-banner', 7 | template: '

banner works!

', 8 | styles: [], 9 | }) 10 | export class BannerComponent {} 11 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/banner/banner.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | standalone: true, 5 | selector: 'app-banner', 6 | template: '

{{title}}

', 7 | styles: ['h1 { color: green; font-size: 350%}'], 8 | }) 9 | export class BannerComponent { 10 | title = 'Test Tour of Heroes'; 11 | } 12 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/dashboard/dashboard-hero.component.css: -------------------------------------------------------------------------------- 1 | .hero { 2 | padding: 20px; 3 | position: relative; 4 | text-align: center; 5 | color: #eee; 6 | max-height: 120px; 7 | width: 100%; 8 | min-width: 120px; 9 | background-color: #607d8b; 10 | border-radius: 2px; 11 | } 12 | 13 | .hero:hover { 14 | background-color: #eee; 15 | cursor: pointer; 16 | color: #607d8b; 17 | } 18 | 19 | @media (max-width: 600px) { 20 | .hero { 21 | font-size: 10px; 22 | max-height: 75px; 23 | } 24 | } 25 | 26 | @media (max-width: 1024px) { 27 | .hero { 28 | min-width: 60px; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/dashboard/dashboard.component.css: -------------------------------------------------------------------------------- 1 | [class*='col-'] { 2 | float: left; 3 | } 4 | *, 5 | *::after, 6 | *::before { 7 | box-sizing: border-box; 8 | } 9 | h3 { 10 | text-align: center; 11 | margin-bottom: 0; 12 | } 13 | [class*='col-'] { 14 | padding-right: 20px; 15 | padding-bottom: 20px; 16 | } 17 | [class*='col-']:last-of-type { 18 | padding-right: 0; 19 | } 20 | .grid { 21 | margin: 0; 22 | } 23 | .col-1-4 { 24 | width: 25%; 25 | } 26 | .grid-pad { 27 | padding: 10px 0; 28 | } 29 | .grid-pad > [class*='col-']:last-of-type { 30 | padding-right: 20px; 31 | } 32 | @media (max-width: 1024px) { 33 | .grid { 34 | margin: 0; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/dashboard/dashboard.component.html: -------------------------------------------------------------------------------- 1 |

{{ title }}

2 | 3 |
4 | 10 | 11 |
12 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/demo/demo-external-template.html: -------------------------------------------------------------------------------- 1 | from external template 2 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/demo/demo-main.ts: -------------------------------------------------------------------------------- 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 2 | 3 | import { demoProviders } from './demo'; 4 | 5 | platformBrowserDynamic([demoProviders]); 6 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/hero/hero-detail.component.css: -------------------------------------------------------------------------------- 1 | label { 2 | display: inline-block; 3 | width: 3em; 4 | margin: 0.5em 0; 5 | color: #607d8b; 6 | font-weight: bold; 7 | } 8 | input { 9 | height: 2em; 10 | font-size: 1em; 11 | padding-left: 0.4em; 12 | } 13 | button { 14 | margin-top: 20px; 15 | font-family: Arial, sans-serif; 16 | background-color: #eee; 17 | border: none; 18 | padding: 5px 10px; 19 | border-radius: 4px; 20 | cursor: pointer; 21 | } 22 | button:hover { 23 | background-color: #cfd8dc; 24 | } 25 | button:disabled { 26 | background-color: #eee; 27 | color: #ccc; 28 | cursor: auto; 29 | } 30 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/hero/hero-detail.component.html: -------------------------------------------------------------------------------- 1 |
2 |

3 | {{ hero.name | titlecase }} Details 4 |

5 |
id: {{ hero.id }}
6 |
7 | 8 | 13 |
14 | 20 | 26 |
27 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/hero/hero-list.component.html: -------------------------------------------------------------------------------- 1 |

My Heroes

2 |
    3 |
  • 4 | 12 |
  • 13 |
14 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/hero/hero.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | 3 | import { HeroDetailComponent } from './hero-detail.component'; 4 | import { HeroListComponent } from './hero-list.component'; 5 | 6 | export default [ 7 | { path: '', component: HeroListComponent }, 8 | { path: ':id', component: HeroDetailComponent }, 9 | ] as Routes; 10 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/model/hero.ts: -------------------------------------------------------------------------------- 1 | export interface Hero { 2 | id: number; 3 | name: string; 4 | } 5 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/model/index.ts: -------------------------------------------------------------------------------- 1 | export * from './hero'; 2 | export * from './hero.service'; 3 | export * from './user.service'; 4 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/model/testing/index.ts: -------------------------------------------------------------------------------- 1 | export * from './test-hero.service'; 2 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/model/testing/test-heroes.ts: -------------------------------------------------------------------------------- 1 | import { Hero } from '../hero'; 2 | 3 | export function getTestHeroes(): Hero[] { 4 | return [ 5 | { id: 41, name: 'Bob' }, 6 | { id: 42, name: 'Carol' }, 7 | { id: 43, name: 'Ted' }, 8 | { id: 44, name: 'Alice' }, 9 | { id: 45, name: 'Speedy' }, 10 | { id: 46, name: 'Stealthy' }, 11 | ]; 12 | } 13 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/model/user.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable() 4 | export class UserService { 5 | isLoggedIn = true; 6 | user = { name: 'Sam Spade' }; 7 | } 8 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/shared/app.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { AppService } from './app.service'; 4 | import { REQUEST } from './app.tokens'; 5 | 6 | describe('AppService', () => { 7 | let service: AppService; 8 | 9 | beforeEach(() => { 10 | TestBed.configureTestingModule({ 11 | providers: [ 12 | { 13 | provide: REQUEST, 14 | useValue: {}, 15 | }, 16 | ], 17 | }); 18 | service = TestBed.inject(AppService); 19 | }); 20 | 21 | it('should be created', () => { 22 | expect(service).toBeTruthy(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/shared/app.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable, inject } from '@angular/core'; 2 | import { toSignal } from '@angular/core/rxjs-interop'; 3 | import { of } from 'rxjs'; 4 | 5 | import { REQUEST } from './app.tokens'; 6 | 7 | @Injectable({ 8 | providedIn: 'root', 9 | }) 10 | export class AppService { 11 | private readonly request = inject(REQUEST); 12 | 13 | get fooText() { 14 | return toSignal(of('world')); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/shared/app.tokens.ts: -------------------------------------------------------------------------------- 1 | import { InjectionToken } from '@angular/core'; 2 | import type { Request } from 'express'; 3 | 4 | export const REQUEST = new InjectionToken('express-request'); 5 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/shared/highlight.directive.ts: -------------------------------------------------------------------------------- 1 | import { Directive, ElementRef, Input, OnChanges } from '@angular/core'; 2 | 3 | @Directive({ standalone: true, selector: '[highlight]' }) 4 | export class HighlightDirective implements OnChanges { 5 | defaultColor = 'rgb(211, 211, 211)'; // lightgray 6 | 7 | @Input('highlight') bgColor = ''; 8 | 9 | constructor(private readonly el: ElementRef) { 10 | el.nativeElement.style.customProperty = true; 11 | } 12 | 13 | ngOnChanges() { 14 | this.el.nativeElement.style.backgroundColor = this.bgColor || this.defaultColor; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/shared/shared.ts: -------------------------------------------------------------------------------- 1 | import { NgFor, NgIf } from '@angular/common'; 2 | import { FormsModule } from '@angular/forms'; 3 | 4 | import * as Services from './app.service'; 5 | import { HighlightDirective } from './highlight.directive'; 6 | import { TitleCasePipe } from './title-case.pipe'; 7 | 8 | const sharedImports = [FormsModule, HighlightDirective, TitleCasePipe, NgIf, NgFor]; 9 | 10 | export { Services, sharedImports, HighlightDirective, TitleCasePipe }; 11 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/shared/title-case.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | 3 | @Pipe({ name: 'titlecase', standalone: true, pure: true }) 4 | export class TitleCasePipe implements PipeTransform { 5 | transform(input: string): string { 6 | return input.length === 0 7 | ? '' 8 | : input.replace(/\w\S*/g, (txt) => txt[0].toUpperCase() + txt.slice(1).toLowerCase()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/twain/quote.ts: -------------------------------------------------------------------------------- 1 | export interface Quote { 2 | id: number; 3 | quote: string; 4 | } 5 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/app/welcome/welcome.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | import { UserService } from '../model'; 4 | 5 | @Component({ 6 | standalone: true, 7 | selector: 'app-welcome', 8 | template: '

{{welcome}}

', 9 | }) 10 | export class WelcomeComponent implements OnInit { 11 | welcome = ''; 12 | constructor(private readonly userService: UserService) {} 13 | 14 | ngOnInit(): void { 15 | this.welcome = this.userService.isLoggedIn ? 'Welcome, ' + this.userService.user.name : 'Please log in.'; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | App Under Test 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/main.ts: -------------------------------------------------------------------------------- 1 | import { bootstrapApplication } from '@angular/platform-browser'; 2 | 3 | import { AppComponent } from './app/app.component'; 4 | import { appConfig } from './app/app.config'; 5 | 6 | bootstrapApplication(AppComponent, appConfig).catch((err) => console.error(err)); 7 | -------------------------------------------------------------------------------- /examples/example-app-v18/src/testing/index.ts: -------------------------------------------------------------------------------- 1 | import { DebugElement } from '@angular/core'; 2 | 3 | export * from './async-observable-helpers'; 4 | 5 | interface IButtonClickEvent { 6 | button: number; 7 | } 8 | 9 | export const ButtonClickEvents: { 10 | left: IButtonClickEvent; 11 | right: IButtonClickEvent; 12 | } = { 13 | left: { button: 0 }, 14 | right: { button: 2 }, 15 | }; 16 | 17 | export function click(el: DebugElement | HTMLElement, eventObj: IButtonClickEvent = ButtonClickEvents.left): void { 18 | if (el instanceof HTMLElement) { 19 | el.click(); 20 | } else { 21 | el.triggerEventHandler('click', eventObj); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/example-app-v18/tsconfig-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "esModuleInterop": true, 5 | "isolatedModules": false, 6 | "module": "ES2022" 7 | }, 8 | "include": [ 9 | "src/**/*.spec.ts", 10 | "src/**/*.d.ts" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /examples/example-app-v18/tsconfig-isolated-esm.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig-esm.spec.json", 4 | "compilerOptions": { 5 | "isolatedModules": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/example-app-v18/tsconfig-isolated.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.spec.json", 4 | "compilerOptions": { 5 | "isolatedModules": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/example-app-v18/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts" 10 | ], 11 | "include": [ 12 | "src/**/*.d.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /examples/example-app-v18/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "module": "CommonJS", 6 | "isolatedModules": false, 7 | "types": [ 8 | "jest" 9 | ] 10 | }, 11 | "include": [ 12 | "src/**/*.spec.ts", 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /examples/example-app-v19/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | ij_typescript_use_double_quotes = false 14 | 15 | [*.md] 16 | max_line_length = off 17 | trim_trailing_whitespace = false 18 | -------------------------------------------------------------------------------- /examples/example-app-v19/jest-esm-isolated.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | import jestCfg from './jest-esm.config'; 4 | 5 | export default { 6 | ...jestCfg, 7 | transform: { 8 | '^.+\\.(ts|js|html|svg)$': [ 9 | 'jest-preset-angular', 10 | { 11 | tsconfig: '/tsconfig-isolated-esm.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | useESM: true, 14 | }, 15 | ], 16 | }, 17 | } satisfies JestConfigWithTsJest; 18 | -------------------------------------------------------------------------------- /examples/example-app-v19/jest-isolated.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'jest'; 2 | import { createCjsPreset } from 'jest-preset-angular/presets'; 3 | 4 | import jestCfg from './jest.config'; 5 | 6 | export default { 7 | ...jestCfg, 8 | ...createCjsPreset({ 9 | tsconfig: '/tsconfig-isolated.spec.json', 10 | }), 11 | } satisfies Config; 12 | -------------------------------------------------------------------------------- /examples/example-app-v19/jest.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'jest'; 2 | import { createCjsPreset } from 'jest-preset-angular/presets'; 3 | import { pathsToModuleNameMapper } from 'ts-jest'; 4 | 5 | import { compilerOptions } from './tsconfig.json'; 6 | 7 | export default { 8 | ...createCjsPreset(), 9 | moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '' }), 10 | setupFilesAfterEnv: ['/setup-jest.ts'], 11 | } satisfies Config; 12 | -------------------------------------------------------------------------------- /examples/example-app-v19/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thymikee/jest-preset-angular/eefc72b40103a6e4156975df1f6f366f69af0172/examples/example-app-v19/public/favicon.ico -------------------------------------------------------------------------------- /examples/example-app-v19/setup-jest-esm.ts: -------------------------------------------------------------------------------- 1 | import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs'; 2 | import './jest-global-mocks'; 3 | 4 | setupZoneTestEnv(); 5 | -------------------------------------------------------------------------------- /examples/example-app-v19/setup-jest.ts: -------------------------------------------------------------------------------- 1 | import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'; 2 | import './jest-global-mocks'; 3 | 4 | setupZoneTestEnv(); 5 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/about/about.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HighlightDirective } from '@shared/highlight.directive'; 3 | 4 | import { TwainComponent } from '../twain/twain.component'; 5 | 6 | @Component({ 7 | template: ` 8 |

About

9 |

Quote of the day:

10 | 11 | `, 12 | imports: [TwainComponent, HighlightDirective], 13 | }) 14 | export class AboutComponent {} 15 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/app-initial.component.ts: -------------------------------------------------------------------------------- 1 | // Reduced version of the initial AppComponent generated by CLI 2 | import { Component } from '@angular/core'; 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | template: '

Welcome to {{title}}!

', 7 | }) 8 | export class AppComponent { 9 | title = 'app'; 10 | } 11 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { DOCUMENT } from '@angular/common'; 2 | import { Component, Inject } from '@angular/core'; 3 | import { RouterLink, RouterOutlet } from '@angular/router'; 4 | 5 | import { BannerComponent } from './banner/banner.component'; 6 | import { WelcomeComponent } from './welcome/welcome.component'; 7 | 8 | @Component({ 9 | selector: 'app-root', 10 | templateUrl: './app.component.html', 11 | imports: [BannerComponent, WelcomeComponent, RouterOutlet, RouterLink], 12 | }) 13 | export class AppComponent { 14 | constructor(@Inject(DOCUMENT) injectedDoc: Document) { 15 | injectedDoc.title = 'Example App'; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/app.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | 3 | import { AboutComponent } from './about/about.component'; 4 | import { DashboardComponent } from './dashboard/dashboard.component'; 5 | 6 | export const routes: Routes = [ 7 | { path: '', redirectTo: 'dashboard', pathMatch: 'full' }, 8 | { path: 'about', component: AboutComponent }, 9 | { path: 'dashboard', component: DashboardComponent }, 10 | { path: 'heroes', loadChildren: () => import('./hero/hero.routes') }, 11 | ]; 12 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/banner/banner-external.component.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: green; 3 | font-size: 350%; 4 | } 5 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/banner/banner-external.component.html: -------------------------------------------------------------------------------- 1 |

{{ title }}

2 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/banner/banner-external.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-banner', 5 | templateUrl: './banner-external.component.html', 6 | styleUrls: ['./banner-external.component.css'], 7 | }) 8 | export class BannerComponent { 9 | title = 'Test Tour of Heroes'; 10 | } 11 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/banner/banner-initial.component.ts: -------------------------------------------------------------------------------- 1 | // BannerComponent as initially generated by the CLI 2 | import { Component } from '@angular/core'; 3 | 4 | @Component({ 5 | selector: 'app-banner', 6 | template: '

banner works!

', 7 | styles: [], 8 | }) 9 | export class BannerComponent {} 10 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/banner/banner.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-banner', 5 | template: '

{{title}}

', 6 | styles: ['h1 { color: green; font-size: 350%}'], 7 | }) 8 | export class BannerComponent { 9 | title = 'Test Tour of Heroes'; 10 | } 11 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/dashboard/dashboard-hero.component.css: -------------------------------------------------------------------------------- 1 | .hero { 2 | padding: 20px; 3 | position: relative; 4 | text-align: center; 5 | color: #eee; 6 | max-height: 120px; 7 | width: 100%; 8 | min-width: 120px; 9 | background-color: #607d8b; 10 | border-radius: 2px; 11 | } 12 | 13 | .hero:hover { 14 | background-color: #eee; 15 | cursor: pointer; 16 | color: #607d8b; 17 | } 18 | 19 | @media (max-width: 600px) { 20 | .hero { 21 | font-size: 10px; 22 | max-height: 75px; 23 | } 24 | } 25 | 26 | @media (max-width: 1024px) { 27 | .hero { 28 | min-width: 60px; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/dashboard/dashboard-hero.component.ts: -------------------------------------------------------------------------------- 1 | import { UpperCasePipe } from '@angular/common'; 2 | import { Component, input, output } from '@angular/core'; 3 | 4 | import { Hero } from '../model'; 5 | 6 | @Component({ 7 | selector: 'dashboard-hero', 8 | template: ` 9 | 12 | `, 13 | styleUrls: ['./dashboard-hero.component.css'], 14 | imports: [UpperCasePipe], 15 | }) 16 | export class DashboardHeroComponent { 17 | hero = input.required(); 18 | readonly selected = output(); 19 | 20 | click() { 21 | this.selected.emit(this.hero()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/dashboard/dashboard.component.css: -------------------------------------------------------------------------------- 1 | [class*='col-'] { 2 | float: left; 3 | } 4 | *, 5 | *::after, 6 | *::before { 7 | box-sizing: border-box; 8 | } 9 | h3 { 10 | text-align: center; 11 | margin-bottom: 0; 12 | } 13 | [class*='col-'] { 14 | padding-right: 20px; 15 | padding-bottom: 20px; 16 | } 17 | [class*='col-']:last-of-type { 18 | padding-right: 0; 19 | } 20 | .grid { 21 | margin: 0; 22 | } 23 | .col-1-4 { 24 | width: 25%; 25 | } 26 | .grid-pad { 27 | padding: 10px 0; 28 | } 29 | .grid-pad > [class*='col-']:last-of-type { 30 | padding-right: 20px; 31 | } 32 | @media (max-width: 1024px) { 33 | .grid { 34 | margin: 0; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/dashboard/dashboard.component.html: -------------------------------------------------------------------------------- 1 |

{{ title }}

2 | 3 |
4 | 10 | 11 |
12 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/demo/demo-external-template.html: -------------------------------------------------------------------------------- 1 | from external template 2 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/demo/demo-main.ts: -------------------------------------------------------------------------------- 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 2 | 3 | import { demoProviders } from './demo'; 4 | 5 | platformBrowserDynamic([demoProviders]); 6 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/hero/hero-detail.component.css: -------------------------------------------------------------------------------- 1 | label { 2 | display: inline-block; 3 | width: 3em; 4 | margin: 0.5em 0; 5 | color: #607d8b; 6 | font-weight: bold; 7 | } 8 | input { 9 | height: 2em; 10 | font-size: 1em; 11 | padding-left: 0.4em; 12 | } 13 | button { 14 | margin-top: 20px; 15 | font-family: Arial, sans-serif; 16 | background-color: #eee; 17 | border: none; 18 | padding: 5px 10px; 19 | border-radius: 4px; 20 | cursor: pointer; 21 | } 22 | button:hover { 23 | background-color: #cfd8dc; 24 | } 25 | button:disabled { 26 | background-color: #eee; 27 | color: #ccc; 28 | cursor: auto; 29 | } 30 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/hero/hero-detail.component.html: -------------------------------------------------------------------------------- 1 |
2 |

3 | {{ hero.name | titlecase }} Details 4 |

5 |
id: {{ hero.id }}
6 |
7 | 8 | 13 |
14 | 20 | 26 |
27 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/hero/hero-list.component.html: -------------------------------------------------------------------------------- 1 |

My Heroes

2 |
    3 |
  • 4 | 12 |
  • 13 |
14 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/hero/hero.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | 3 | import { HeroDetailComponent } from './hero-detail.component'; 4 | import { HeroListComponent } from './hero-list.component'; 5 | 6 | export default [ 7 | { path: '', component: HeroListComponent }, 8 | { path: ':id', component: HeroDetailComponent }, 9 | ] as Routes; 10 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/model/hero.ts: -------------------------------------------------------------------------------- 1 | export interface Hero { 2 | id: number; 3 | name: string; 4 | } 5 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/model/index.ts: -------------------------------------------------------------------------------- 1 | export * from './hero'; 2 | export * from './hero.service'; 3 | export * from './user.service'; 4 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/model/testing/index.ts: -------------------------------------------------------------------------------- 1 | export * from './test-hero.service'; 2 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/model/testing/test-heroes.ts: -------------------------------------------------------------------------------- 1 | import { Hero } from '../hero'; 2 | 3 | export function getTestHeroes(): Hero[] { 4 | return [ 5 | { id: 41, name: 'Bob' }, 6 | { id: 42, name: 'Carol' }, 7 | { id: 43, name: 'Ted' }, 8 | { id: 44, name: 'Alice' }, 9 | { id: 45, name: 'Speedy' }, 10 | { id: 46, name: 'Stealthy' }, 11 | ]; 12 | } 13 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/model/user.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable() 4 | export class UserService { 5 | isLoggedIn = true; 6 | user = { name: 'Sam Spade' }; 7 | } 8 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/shared/app.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { AppService } from './app.service'; 4 | import { REQUEST } from './app.tokens'; 5 | 6 | describe('AppService', () => { 7 | let service: AppService; 8 | 9 | beforeEach(() => { 10 | TestBed.configureTestingModule({ 11 | providers: [ 12 | { 13 | provide: REQUEST, 14 | useValue: {}, 15 | }, 16 | ], 17 | }); 18 | service = TestBed.inject(AppService); 19 | }); 20 | 21 | it('should be created', () => { 22 | expect(service).toBeTruthy(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/shared/app.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable, inject } from '@angular/core'; 2 | 3 | import { REQUEST } from './app.tokens'; 4 | 5 | @Injectable({ 6 | providedIn: 'root', 7 | }) 8 | export class AppService { 9 | private readonly request = inject(REQUEST); 10 | } 11 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/shared/app.tokens.ts: -------------------------------------------------------------------------------- 1 | import { InjectionToken } from '@angular/core'; 2 | import type { Request } from 'express'; 3 | 4 | export const REQUEST = new InjectionToken('express-request'); 5 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/shared/highlight.directive.ts: -------------------------------------------------------------------------------- 1 | import { Directive, ElementRef, Input, OnChanges } from '@angular/core'; 2 | 3 | @Directive({ selector: '[highlight]' }) 4 | export class HighlightDirective implements OnChanges { 5 | defaultColor = 'rgb(211, 211, 211)'; // lightgray 6 | 7 | @Input('highlight') bgColor = ''; 8 | 9 | constructor(private readonly el: ElementRef) { 10 | el.nativeElement.style.customProperty = true; 11 | } 12 | 13 | ngOnChanges() { 14 | this.el.nativeElement.style.backgroundColor = this.bgColor || this.defaultColor; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/shared/shared.ts: -------------------------------------------------------------------------------- 1 | import { NgFor, NgIf } from '@angular/common'; 2 | import { FormsModule } from '@angular/forms'; 3 | 4 | import * as Services from './app.service'; 5 | import { HighlightDirective } from './highlight.directive'; 6 | import { TitleCasePipe } from './title-case.pipe'; 7 | 8 | const sharedImports = [FormsModule, HighlightDirective, TitleCasePipe, NgIf, NgFor]; 9 | 10 | export { Services, sharedImports, HighlightDirective, TitleCasePipe }; 11 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/shared/title-case.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | 3 | @Pipe({ name: 'titlecase', pure: true }) 4 | export class TitleCasePipe implements PipeTransform { 5 | transform(input: string): string { 6 | return input.length === 0 7 | ? '' 8 | : input.replace(/\w\S*/g, (txt) => txt[0].toUpperCase() + txt.slice(1).toLowerCase()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/twain/quote.ts: -------------------------------------------------------------------------------- 1 | export interface Quote { 2 | id: number; 3 | quote: string; 4 | } 5 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/app/welcome/welcome.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | import { UserService } from '../model'; 4 | 5 | @Component({ 6 | selector: 'app-welcome', 7 | template: '

{{welcome}}

', 8 | }) 9 | export class WelcomeComponent implements OnInit { 10 | welcome = ''; 11 | constructor(private readonly userService: UserService) {} 12 | 13 | ngOnInit(): void { 14 | this.welcome = this.userService.isLoggedIn ? 'Welcome, ' + this.userService.user.name : 'Please log in.'; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | App Under Test 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/main.ts: -------------------------------------------------------------------------------- 1 | import { bootstrapApplication } from '@angular/platform-browser'; 2 | 3 | import { AppComponent } from './app/app.component'; 4 | import { appConfig } from './app/app.config'; 5 | 6 | bootstrapApplication(AppComponent, appConfig).catch((err) => console.error(err)); 7 | -------------------------------------------------------------------------------- /examples/example-app-v19/src/testing/index.ts: -------------------------------------------------------------------------------- 1 | import { DebugElement } from '@angular/core'; 2 | 3 | export * from './async-observable-helpers'; 4 | 5 | interface IButtonClickEvent { 6 | button: number; 7 | } 8 | 9 | export const ButtonClickEvents: { 10 | left: IButtonClickEvent; 11 | right: IButtonClickEvent; 12 | } = { 13 | left: { button: 0 }, 14 | right: { button: 2 }, 15 | }; 16 | 17 | export function click(el: DebugElement | HTMLElement, eventObj: IButtonClickEvent = ButtonClickEvents.left): void { 18 | if (el instanceof HTMLElement) { 19 | el.click(); 20 | } else { 21 | el.triggerEventHandler('click', eventObj); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/example-app-v19/tsconfig-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "esModuleInterop": true, 5 | "isolatedModules": false, 6 | "module": "ES2022" 7 | }, 8 | "include": [ 9 | "src/**/*.spec.ts", 10 | "src/**/*.d.ts" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /examples/example-app-v19/tsconfig-isolated-esm.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig-esm.spec.json", 4 | "compilerOptions": { 5 | "isolatedModules": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/example-app-v19/tsconfig-isolated.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.spec.json", 4 | "compilerOptions": { 5 | "isolatedModules": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/example-app-v19/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/app", 7 | "types": [] 8 | }, 9 | "files": [ 10 | "src/main.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /examples/example-app-v19/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/spec", 7 | "module": "CommonJS", 8 | "isolatedModules": false, 9 | "types": ["jest"] 10 | }, 11 | "include": ["src/**/*.spec.ts", "src/**/*.d.ts"] 12 | } 13 | -------------------------------------------------------------------------------- /examples/example-app-v20/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | ij_typescript_use_double_quotes = false 14 | 15 | [*.md] 16 | max_line_length = off 17 | trim_trailing_whitespace = false 18 | -------------------------------------------------------------------------------- /examples/example-app-v20/jest-esm-isolated.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | import jestCfg from './jest-esm.config'; 4 | 5 | export default { 6 | ...jestCfg, 7 | transform: { 8 | '^.+\\.(ts|js|html|svg)$': [ 9 | 'jest-preset-angular', 10 | { 11 | tsconfig: '/tsconfig-isolated-esm.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | useESM: true, 14 | }, 15 | ], 16 | }, 17 | } satisfies JestConfigWithTsJest; 18 | -------------------------------------------------------------------------------- /examples/example-app-v20/jest-isolated.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'jest'; 2 | import { createCjsPreset } from 'jest-preset-angular/presets'; 3 | 4 | import jestCfg from './jest.config'; 5 | 6 | export default { 7 | ...jestCfg, 8 | ...createCjsPreset({ 9 | tsconfig: '/tsconfig-isolated.spec.json', 10 | }), 11 | } satisfies Config; 12 | -------------------------------------------------------------------------------- /examples/example-app-v20/jest.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'jest'; 2 | import { createCjsPreset } from 'jest-preset-angular/presets'; 3 | import { pathsToModuleNameMapper } from 'ts-jest'; 4 | 5 | import { compilerOptions } from './tsconfig.json'; 6 | 7 | export default { 8 | ...createCjsPreset(), 9 | moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '' }), 10 | setupFilesAfterEnv: ['/setup-jest.ts'], 11 | } satisfies Config; 12 | -------------------------------------------------------------------------------- /examples/example-app-v20/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thymikee/jest-preset-angular/eefc72b40103a6e4156975df1f6f366f69af0172/examples/example-app-v20/public/favicon.ico -------------------------------------------------------------------------------- /examples/example-app-v20/setup-jest-esm.ts: -------------------------------------------------------------------------------- 1 | import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs'; 2 | import './jest-global-mocks'; 3 | 4 | setupZoneTestEnv(); 5 | -------------------------------------------------------------------------------- /examples/example-app-v20/setup-jest.ts: -------------------------------------------------------------------------------- 1 | import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'; 2 | import './jest-global-mocks'; 3 | 4 | setupZoneTestEnv(); 5 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/about/about.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HighlightDirective } from '@shared/highlight.directive'; 3 | 4 | import { TwainComponent } from '../twain/twain.component'; 5 | 6 | @Component({ 7 | template: ` 8 |

About

9 |

Quote of the day:

10 | 11 | `, 12 | imports: [TwainComponent, HighlightDirective], 13 | }) 14 | export class AboutComponent {} 15 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/app-initial.ts: -------------------------------------------------------------------------------- 1 | // Reduced version of the initial AppComponent generated by CLI 2 | import { Component } from '@angular/core'; 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | template: '

Welcome to {{title}}!

', 7 | }) 8 | export class AppInitial { 9 | title = 'app'; 10 | } 11 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/app.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | 3 | import { AboutComponent } from './about/about.component'; 4 | import { DashboardComponent } from './dashboard/dashboard.component'; 5 | 6 | export const routes: Routes = [ 7 | { path: '', redirectTo: 'dashboard', pathMatch: 'full' }, 8 | { path: 'about', component: AboutComponent }, 9 | { path: 'dashboard', component: DashboardComponent }, 10 | { path: 'heroes', loadChildren: () => import('./hero/hero.routes') }, 11 | ]; 12 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/app.ts: -------------------------------------------------------------------------------- 1 | import { DOCUMENT } from '@angular/common'; 2 | import { Component, Inject } from '@angular/core'; 3 | import { RouterLink, RouterOutlet } from '@angular/router'; 4 | 5 | import { BannerComponent } from './banner/banner.component'; 6 | import { WelcomeComponent } from './welcome/welcome.component'; 7 | 8 | @Component({ 9 | selector: 'app-root', 10 | imports: [BannerComponent, WelcomeComponent, RouterOutlet, RouterLink], 11 | templateUrl: './app.html', 12 | }) 13 | export class App { 14 | constructor(@Inject(DOCUMENT) injectedDoc: Document) { 15 | injectedDoc.title = 'Example App'; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/banner/banner-external.component.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: green; 3 | font-size: 350%; 4 | } 5 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/banner/banner-external.component.html: -------------------------------------------------------------------------------- 1 |

{{ title }}

2 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/banner/banner-external.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-banner', 5 | templateUrl: './banner-external.component.html', 6 | styleUrls: ['./banner-external.component.css'], 7 | }) 8 | export class BannerComponent { 9 | title = 'Test Tour of Heroes'; 10 | } 11 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/banner/banner-initial.component.ts: -------------------------------------------------------------------------------- 1 | // BannerComponent as initially generated by the CLI 2 | import { Component } from '@angular/core'; 3 | 4 | @Component({ 5 | selector: 'app-banner', 6 | template: '

banner works!

', 7 | styles: [], 8 | }) 9 | export class BannerComponent {} 10 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/banner/banner.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-banner', 5 | template: '

{{title}}

', 6 | styles: ['h1 { color: green; font-size: 350%}'], 7 | }) 8 | export class BannerComponent { 9 | title = 'Test Tour of Heroes'; 10 | } 11 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/dashboard/dashboard-hero.component.css: -------------------------------------------------------------------------------- 1 | .hero { 2 | padding: 20px; 3 | position: relative; 4 | text-align: center; 5 | color: #eee; 6 | max-height: 120px; 7 | width: 100%; 8 | min-width: 120px; 9 | background-color: #607d8b; 10 | border-radius: 2px; 11 | } 12 | 13 | .hero:hover { 14 | background-color: #eee; 15 | cursor: pointer; 16 | color: #607d8b; 17 | } 18 | 19 | @media (max-width: 600px) { 20 | .hero { 21 | font-size: 10px; 22 | max-height: 75px; 23 | } 24 | } 25 | 26 | @media (max-width: 1024px) { 27 | .hero { 28 | min-width: 60px; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/dashboard/dashboard-hero.component.ts: -------------------------------------------------------------------------------- 1 | import { UpperCasePipe } from '@angular/common'; 2 | import { Component, input, output } from '@angular/core'; 3 | 4 | import { Hero } from '../model'; 5 | 6 | @Component({ 7 | selector: 'dashboard-hero', 8 | template: ` 9 | 12 | `, 13 | styleUrls: ['./dashboard-hero.component.css'], 14 | imports: [UpperCasePipe], 15 | }) 16 | export class DashboardHeroComponent { 17 | hero = input.required(); 18 | readonly selected = output(); 19 | 20 | click() { 21 | this.selected.emit(this.hero()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/dashboard/dashboard.component.css: -------------------------------------------------------------------------------- 1 | [class*='col-'] { 2 | float: left; 3 | } 4 | *, 5 | *::after, 6 | *::before { 7 | box-sizing: border-box; 8 | } 9 | h3 { 10 | text-align: center; 11 | margin-bottom: 0; 12 | } 13 | [class*='col-'] { 14 | padding-right: 20px; 15 | padding-bottom: 20px; 16 | } 17 | [class*='col-']:last-of-type { 18 | padding-right: 0; 19 | } 20 | .grid { 21 | margin: 0; 22 | } 23 | .col-1-4 { 24 | width: 25%; 25 | } 26 | .grid-pad { 27 | padding: 10px 0; 28 | } 29 | .grid-pad > [class*='col-']:last-of-type { 30 | padding-right: 20px; 31 | } 32 | @media (max-width: 1024px) { 33 | .grid { 34 | margin: 0; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/dashboard/dashboard.component.html: -------------------------------------------------------------------------------- 1 |

{{ title }}

2 | 3 |
4 | 10 | 11 |
12 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/demo/demo-external-template.html: -------------------------------------------------------------------------------- 1 | from external template 2 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/demo/demo-main.ts: -------------------------------------------------------------------------------- 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 2 | 3 | import { demoProviders } from './demo'; 4 | 5 | platformBrowserDynamic([demoProviders]); 6 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/hero/hero-detail.component.css: -------------------------------------------------------------------------------- 1 | label { 2 | display: inline-block; 3 | width: 3em; 4 | margin: 0.5em 0; 5 | color: #607d8b; 6 | font-weight: bold; 7 | } 8 | input { 9 | height: 2em; 10 | font-size: 1em; 11 | padding-left: 0.4em; 12 | } 13 | button { 14 | margin-top: 20px; 15 | font-family: Arial, sans-serif; 16 | background-color: #eee; 17 | border: none; 18 | padding: 5px 10px; 19 | border-radius: 4px; 20 | cursor: pointer; 21 | } 22 | button:hover { 23 | background-color: #cfd8dc; 24 | } 25 | button:disabled { 26 | background-color: #eee; 27 | color: #ccc; 28 | cursor: auto; 29 | } 30 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/hero/hero-detail.component.html: -------------------------------------------------------------------------------- 1 |
2 |

3 | {{ hero.name | titlecase }} Details 4 |

5 |
id: {{ hero.id }}
6 |
7 | 8 | 13 |
14 | 20 | 26 |
27 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/hero/hero-list.component.html: -------------------------------------------------------------------------------- 1 |

My Heroes

2 |
    3 |
  • 4 | 12 |
  • 13 |
14 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/hero/hero.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | 3 | import { HeroDetailComponent } from './hero-detail.component'; 4 | import { HeroListComponent } from './hero-list.component'; 5 | 6 | export default [ 7 | { path: '', component: HeroListComponent }, 8 | { path: ':id', component: HeroDetailComponent }, 9 | ] as Routes; 10 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/model/hero.ts: -------------------------------------------------------------------------------- 1 | export interface Hero { 2 | id: number; 3 | name: string; 4 | } 5 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/model/index.ts: -------------------------------------------------------------------------------- 1 | export * from './hero'; 2 | export * from './hero.service'; 3 | export * from './user.service'; 4 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/model/testing/index.ts: -------------------------------------------------------------------------------- 1 | export * from './test-hero.service'; 2 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/model/testing/test-heroes.ts: -------------------------------------------------------------------------------- 1 | import { Hero } from '../hero'; 2 | 3 | export function getTestHeroes(): Hero[] { 4 | return [ 5 | { id: 41, name: 'Bob' }, 6 | { id: 42, name: 'Carol' }, 7 | { id: 43, name: 'Ted' }, 8 | { id: 44, name: 'Alice' }, 9 | { id: 45, name: 'Speedy' }, 10 | { id: 46, name: 'Stealthy' }, 11 | ]; 12 | } 13 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/model/user.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable() 4 | export class UserService { 5 | isLoggedIn = true; 6 | user = { name: 'Sam Spade' }; 7 | } 8 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/shared/app.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { AppService } from './app.service'; 4 | import { REQUEST } from './app.tokens'; 5 | 6 | describe('AppService', () => { 7 | let service: AppService; 8 | 9 | beforeEach(() => { 10 | TestBed.configureTestingModule({ 11 | providers: [ 12 | { 13 | provide: REQUEST, 14 | useValue: {}, 15 | }, 16 | ], 17 | }); 18 | service = TestBed.inject(AppService); 19 | }); 20 | 21 | it('should be created', () => { 22 | expect(service).toBeTruthy(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/shared/app.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable, inject } from '@angular/core'; 2 | 3 | import { REQUEST } from './app.tokens'; 4 | 5 | @Injectable({ 6 | providedIn: 'root', 7 | }) 8 | export class AppService { 9 | private readonly request = inject(REQUEST); 10 | } 11 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/shared/app.tokens.ts: -------------------------------------------------------------------------------- 1 | import { InjectionToken } from '@angular/core'; 2 | import type { Request } from 'express'; 3 | 4 | export const REQUEST = new InjectionToken('express-request'); 5 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/shared/highlight.directive.ts: -------------------------------------------------------------------------------- 1 | import { Directive, ElementRef, Input, OnChanges } from '@angular/core'; 2 | 3 | @Directive({ selector: '[highlight]' }) 4 | export class HighlightDirective implements OnChanges { 5 | defaultColor = 'rgb(211, 211, 211)'; // lightgray 6 | 7 | @Input('highlight') bgColor = ''; 8 | 9 | constructor(private readonly el: ElementRef) { 10 | el.nativeElement.style.customProperty = true; 11 | } 12 | 13 | ngOnChanges() { 14 | this.el.nativeElement.style.backgroundColor = this.bgColor || this.defaultColor; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/shared/shared.ts: -------------------------------------------------------------------------------- 1 | import { NgFor, NgIf } from '@angular/common'; 2 | import { FormsModule } from '@angular/forms'; 3 | 4 | import * as Services from './app.service'; 5 | import { HighlightDirective } from './highlight.directive'; 6 | import { TitleCasePipe } from './title-case.pipe'; 7 | 8 | const sharedImports = [FormsModule, HighlightDirective, TitleCasePipe, NgIf, NgFor]; 9 | 10 | export { Services, sharedImports, HighlightDirective, TitleCasePipe }; 11 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/shared/title-case.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | 3 | @Pipe({ name: 'titlecase', pure: true }) 4 | export class TitleCasePipe implements PipeTransform { 5 | transform(input: string): string { 6 | return input.length === 0 7 | ? '' 8 | : input.replace(/\w\S*/g, (txt) => txt[0].toUpperCase() + txt.slice(1).toLowerCase()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/twain/quote.ts: -------------------------------------------------------------------------------- 1 | export interface Quote { 2 | id: number; 3 | quote: string; 4 | } 5 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/app/welcome/welcome.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | import { UserService } from '../model'; 4 | 5 | @Component({ 6 | selector: 'app-welcome', 7 | template: '

{{welcome}}

', 8 | }) 9 | export class WelcomeComponent implements OnInit { 10 | welcome = ''; 11 | constructor(private readonly userService: UserService) {} 12 | 13 | ngOnInit(): void { 14 | this.welcome = this.userService.isLoggedIn ? 'Welcome, ' + this.userService.user.name : 'Please log in.'; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | App Under Test 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/main.ts: -------------------------------------------------------------------------------- 1 | import { bootstrapApplication } from '@angular/platform-browser'; 2 | 3 | import { App } from './app/app'; 4 | import { appConfig } from './app/app.config'; 5 | 6 | bootstrapApplication(App, appConfig).catch((err) => console.error(err)); 7 | -------------------------------------------------------------------------------- /examples/example-app-v20/src/testing/index.ts: -------------------------------------------------------------------------------- 1 | import { DebugElement } from '@angular/core'; 2 | 3 | export * from './async-observable-helpers'; 4 | 5 | interface IButtonClickEvent { 6 | button: number; 7 | } 8 | 9 | export const ButtonClickEvents: { 10 | left: IButtonClickEvent; 11 | right: IButtonClickEvent; 12 | } = { 13 | left: { button: 0 }, 14 | right: { button: 2 }, 15 | }; 16 | 17 | export function click(el: DebugElement | HTMLElement, eventObj: IButtonClickEvent = ButtonClickEvents.left): void { 18 | if (el instanceof HTMLElement) { 19 | el.click(); 20 | } else { 21 | el.triggerEventHandler('click', eventObj); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/example-app-v20/tsconfig-esm.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "esModuleInterop": true, 5 | "isolatedModules": false, 6 | "module": "ES2022" 7 | }, 8 | "include": ["src/**/*.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /examples/example-app-v20/tsconfig-isolated-esm.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig-esm.spec.json", 4 | "compilerOptions": { 5 | "isolatedModules": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/example-app-v20/tsconfig-isolated.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.spec.json", 4 | "compilerOptions": { 5 | "isolatedModules": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/example-app-v20/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/app", 7 | "types": [] 8 | }, 9 | "include": ["src/**/*.ts"], 10 | "exclude": ["src/**/*.spec.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /examples/example-app-v20/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ 2 | /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ 3 | { 4 | "extends": "./tsconfig.json", 5 | "compilerOptions": { 6 | "outDir": "./out-tsc/spec", 7 | "module": "CommonJS", 8 | "isolatedModules": false, 9 | "types": ["jest"] 10 | }, 11 | "include": ["jest.config.ts", "src/**/*.ts"] 12 | } 13 | -------------------------------------------------------------------------------- /global-setup.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./build/config/global-setup').globalSetup; 2 | -------------------------------------------------------------------------------- /global-setup.mjs: -------------------------------------------------------------------------------- 1 | import { globalSetup } from './build/config/global-setup.js'; 2 | 3 | export default globalSetup; 4 | -------------------------------------------------------------------------------- /jest-cjs.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from '@jest/types'; 2 | 3 | const config: Config.InitialOptions = { 4 | globalSetup: './e2e/global-setup.ts', 5 | projects: ['e2e/**/jest-cjs.config.ts', 'e2e/**/jest-transpile-cjs.config.ts'], 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /jest-esm.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from '@jest/types'; 2 | 3 | const config: Config.InitialOptions = { 4 | globalSetup: './e2e/global-setup.ts', 5 | projects: ['e2e/**/jest-esm.config.ts', 'e2e/**/jest-transpile-esm.config.ts'], 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /jest-preset.js: -------------------------------------------------------------------------------- 1 | const { createCjsPreset } = require('./presets'); 2 | 3 | module.exports = createCjsPreset(); 4 | -------------------------------------------------------------------------------- /jest.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'jest'; 2 | 3 | const config: Config = { 4 | modulePathIgnorePatterns: ['examples/.*', 'website/.*'], 5 | testMatch: ['/src/**/*.spec.ts'], 6 | testEnvironment: 'jsdom', 7 | transform: { 8 | '^.+\\.(ts|js|mjs|html)$': [ 9 | '/build/index.js', 10 | { 11 | tsconfig: 'tsconfig-base.spec.json', 12 | }, 13 | ], 14 | }, 15 | }; 16 | 17 | export default config; 18 | -------------------------------------------------------------------------------- /performance/jest.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'jest'; 2 | 3 | const config: Config = { 4 | transform: { 5 | '^.+\\.(ts|mjs|js|html)$': '/../build/index.js', 6 | }, 7 | transformIgnorePatterns: ['node_modules/(?!lodash-es)'], 8 | }; 9 | 10 | export default config; 11 | -------------------------------------------------------------------------------- /performance/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "performance", 3 | "private": true, 4 | "devDependencies": { 5 | "@types/lodash-es": "^4.17.12", 6 | "jest": "^29.7.0", 7 | "lodash-es": "^4.17.21", 8 | "ts-jest": "^29.3.4", 9 | "typescript": "^5.7.3" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /performance/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "isolatedModules": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /presets/defaults-esm/jest-preset.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../../build/presets').defaultsESM; 2 | -------------------------------------------------------------------------------- /presets/defaults/jest-preset.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../../build/presets').defaultPreset; 2 | -------------------------------------------------------------------------------- /presets/index.d.ts: -------------------------------------------------------------------------------- 1 | import presetEntries from '../build/presets'; 2 | 3 | export = presetEntries; 4 | -------------------------------------------------------------------------------- /presets/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../build/presets'); 2 | -------------------------------------------------------------------------------- /scripts/logger.js: -------------------------------------------------------------------------------- 1 | module.exports = console; 2 | -------------------------------------------------------------------------------- /setup-env/zone/index.d.mts: -------------------------------------------------------------------------------- 1 | import type { TestEnvironmentOptions } from '@angular/core/testing'; 2 | 3 | export declare const setupZoneTestEnv: (options?: TestEnvironmentOptions) => void; 4 | -------------------------------------------------------------------------------- /setup-env/zone/index.d.ts: -------------------------------------------------------------------------------- 1 | import type { TestEnvironmentOptions } from '@angular/core/testing'; 2 | 3 | declare const _default: { 4 | setupZoneTestEnv: (options?: TestEnvironmentOptions) => void; 5 | }; 6 | export = _default; 7 | -------------------------------------------------------------------------------- /setup-env/zone/index.mjs: -------------------------------------------------------------------------------- 1 | import 'zone.js'; 2 | import 'zone.js/testing'; 3 | 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; 6 | 7 | import { polyfillEncoder, resolveTestEnvOptions } from '../utils'; 8 | 9 | const setupZoneTestEnv = (options) => { 10 | polyfillEncoder(); 11 | const testEnvironmentOptions = resolveTestEnvOptions(options); 12 | 13 | getTestBed().initTestEnvironment( 14 | [BrowserDynamicTestingModule], 15 | platformBrowserDynamicTesting(), 16 | testEnvironmentOptions, 17 | ); 18 | }; 19 | 20 | export { setupZoneTestEnv }; 21 | -------------------------------------------------------------------------------- /setup-env/zoneless/index.d.mts: -------------------------------------------------------------------------------- 1 | import type { TestEnvironmentOptions } from '@angular/core/testing'; 2 | 3 | export declare const setupZonelessTestEnv: (options?: TestEnvironmentOptions) => void; 4 | -------------------------------------------------------------------------------- /setup-env/zoneless/index.d.ts: -------------------------------------------------------------------------------- 1 | import type { TestEnvironmentOptions } from '@angular/core/testing'; 2 | 3 | declare const _default: { 4 | setupZonelessTestEnv: (options?: TestEnvironmentOptions) => void; 5 | }; 6 | export = _default; 7 | -------------------------------------------------------------------------------- /sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.organization=thymikee 2 | sonar.projectKey=thymikee_jest-preset-angular 3 | sonar.sources=src 4 | sonar.language=ts 5 | sonar.sourceEncoding=UTF-8 6 | sonar.javascript.lcov.reportPaths=coverage/lcov.info 7 | sonar.typescript.tsconfigPath=tsconfig.json 8 | sonar.exclusions=\ 9 | **/*.md, \ 10 | **/jest.config.ts, \ 11 | **/jest-*.config.ts, \ 12 | **/*.spec.ts, \ 13 | **/**.spec.ts, \ 14 | website/** \ 15 | examples/** 16 | -------------------------------------------------------------------------------- /src/config/global-setup.ts: -------------------------------------------------------------------------------- 1 | import { runNgccJestProcessor } from '../utils/ngcc-jest-processor'; 2 | 3 | export const globalSetup = async () => { 4 | const ngJestConfig = globalThis.ngJest; 5 | const tsconfig = ngJestConfig?.tsconfig; 6 | if (!ngJestConfig?.skipNgcc) { 7 | runNgccJestProcessor(tsconfig); 8 | } 9 | }; 10 | -------------------------------------------------------------------------------- /src/constants.ts: -------------------------------------------------------------------------------- 1 | /** Angular component decorator templateUrl property name */ 2 | export const TEMPLATE_URL = 'templateUrl'; 3 | /** Angular component decorator styleUrls property name */ 4 | export const STYLE_URLS = 'styleUrls'; 5 | /** Angular component decorator styleUrl property name */ 6 | export const STYLE_URL = 'styleUrl'; 7 | /** Angular component decorator styles property name */ 8 | export const STYLES = 'styles'; 9 | /** Angular component decorator template property name */ 10 | export const TEMPLATE = 'template'; 11 | /** Node require function name */ 12 | export const REQUIRE = 'require'; 13 | /** Angular component decorator name */ 14 | export const COMPONENT = 'Component'; 15 | -------------------------------------------------------------------------------- /src/environments/jest-jsdom-env.ts: -------------------------------------------------------------------------------- 1 | import type { EnvironmentContext, JestEnvironmentConfig } from '@jest/environment'; 2 | import * as JSDOM from 'jsdom'; 3 | import { rootLogger } from 'ts-jest'; 4 | 5 | // TODO: Replace with the correct import from `@jest/environment-jsdom-abstract` when Jest 30 is released 6 | import BaseEnv from './jest-env-jsdom-abstract'; 7 | 8 | export default class JestJSDOMEnvironment extends BaseEnv { 9 | constructor(config: JestEnvironmentConfig, context: EnvironmentContext) { 10 | super(config, context, JSDOM); 11 | 12 | rootLogger.debug('JSDOM version: ', require('jsdom/package.json').version); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/global.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 3 | import type { TestEnvironmentOptions } from '@angular/core/testing'; 4 | 5 | declare global { 6 | var ngJest: 7 | | { 8 | skipNgcc?: boolean; 9 | tsconfig?: string; 10 | testEnvironmentOptions?: TestEnvironmentOptions; 11 | } 12 | | undefined; 13 | } 14 | 15 | export {}; 16 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import type { TsJestTransformerOptions } from 'ts-jest'; 2 | 3 | import { NgJestTransformer } from './ng-jest-transformer'; 4 | 5 | export default { 6 | createTransformer: (tsJestConfig?: TsJestTransformerOptions): NgJestTransformer => 7 | new NgJestTransformer(tsJestConfig), 8 | }; 9 | -------------------------------------------------------------------------------- /src/presets/utils.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'jest'; 2 | 3 | import snapshotSerializers from '../serializers'; 4 | 5 | type BasePresetConfig = Required>; 6 | 7 | export const basePresetConfig: BasePresetConfig = { 8 | testEnvironment: 'jsdom', 9 | moduleFileExtensions: ['ts', 'html', 'js', 'json', 'mjs'], 10 | snapshotSerializers, 11 | }; 12 | -------------------------------------------------------------------------------- /src/resolvers/ng-jest-resolver.ts: -------------------------------------------------------------------------------- 1 | import type { SyncResolver } from 'jest-resolve'; 2 | 3 | const ngJestResolver: SyncResolver = (path, options) => { 4 | return options.defaultResolver(path, { 5 | ...options, 6 | packageFilter(pkg) { 7 | return { 8 | ...pkg, 9 | main: pkg.main || pkg.es2015 || pkg.module, 10 | }; 11 | }, 12 | }); 13 | }; 14 | 15 | export = ngJestResolver; 16 | -------------------------------------------------------------------------------- /src/serializers/html-comment.ts: -------------------------------------------------------------------------------- 1 | const HTML_ELEMENT_REGEXP = /Comment/; 2 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 3 | const test = (value: any): boolean => 4 | value?.nodeType === 8 && value.constructor !== undefined && HTML_ELEMENT_REGEXP.test(value.constructor.name); 5 | 6 | const serialize = (): string => ''; 7 | 8 | export = { 9 | serialize, 10 | test, 11 | }; 12 | -------------------------------------------------------------------------------- /src/serializers/index.spec.ts: -------------------------------------------------------------------------------- 1 | import exposedSerializers from './'; 2 | 3 | test('should expose 3 serializers', () => { 4 | expect(exposedSerializers).toMatchInlineSnapshot(` 5 | [ 6 | "jest-preset-angular/build/serializers/html-comment", 7 | "jest-preset-angular/build/serializers/ng-snapshot", 8 | "jest-preset-angular/build/serializers/no-ng-attributes", 9 | ] 10 | `); 11 | }); 12 | -------------------------------------------------------------------------------- /src/serializers/index.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'jest'; 2 | 3 | export = [ 4 | 'jest-preset-angular/build/serializers/html-comment', 5 | 'jest-preset-angular/build/serializers/ng-snapshot', 6 | 'jest-preset-angular/build/serializers/no-ng-attributes', 7 | ] satisfies Config['snapshotSerializers']; 8 | -------------------------------------------------------------------------------- /src/serializers/ng-snapshot.spec.ts: -------------------------------------------------------------------------------- 1 | import ngSnapshot from './ng-snapshot'; 2 | 3 | describe('ng-snapshot snapshot serializer', () => { 4 | test('should return true when matching the condition', () => { 5 | expect(ngSnapshot.test({ componentRef: 'foo' })).toBe(true); 6 | }); 7 | 8 | test.each([undefined, null, 1, {}])('should return false when not matching the condition', (value) => { 9 | expect(ngSnapshot.test(value)).toBe(false); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /src/transformers/esm_interop_inject.cjs: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview This file will be inlined when generating the CommonJS bundle 3 | * for the transformers. ESBuild is not able to transform `import.meta.url` ESM 4 | * usages directly, so we define `import.meta.url` using its CommonJS variant. 5 | */ 6 | 7 | export const import_meta_url = require('url').pathToFileURL(__filename); 8 | -------------------------------------------------------------------------------- /src/transformers/jit_transform.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview This file will be replaced as a build step with a bundled 3 | * CommonJS version of the Angular JIT transform. 4 | * 5 | * This is necessary because the Jest preset is shipped as CommonJS, while the Angular 6 | * compiler CLI is a strict ESM package that would otherwise require migration to ESM 7 | * of the preset, or result in asynchronous ESM/CJS interops being necessary. 8 | */ 9 | 10 | export { angularJitApplicationTransform } from '@angular/compiler-cli'; 11 | -------------------------------------------------------------------------------- /tsconfig-base.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "CommonJS", 5 | "types": ["jest"], 6 | "isolatedModules": false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./build", 5 | "allowJs": true, 6 | "removeComments": true, 7 | "stripInternal": true, 8 | "declaration": true 9 | }, 10 | "include": ["src"], 11 | "exclude": ["**/*.spec.ts", "src/transformers/jit_transform.js"] 12 | } 13 | -------------------------------------------------------------------------------- /tsconfig.eslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "files": [ 4 | ".eslintrc.js" 5 | ], 6 | "include": ["**/*"], 7 | "exclude": ["build", ".yarn"] 8 | } 9 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "./", 4 | "strict": true, 5 | "allowJs": true, 6 | "experimentalDecorators": true, 7 | "forceConsistentCasingInFileNames": true, 8 | "noFallthroughCasesInSwitch": true, 9 | "noUnusedLocals": true, 10 | "noUnusedParameters": true, 11 | "noImplicitReturns": true, 12 | "skipLibCheck": true, 13 | "esModuleInterop": true, 14 | "resolveJsonModule": true, 15 | "isolatedModules": true, 16 | "moduleResolution": "Node", 17 | "target": "ES2015", 18 | "module": "CommonJS", 19 | "lib": ["esnext", "dom"], 20 | "types": ["node", "jest"] 21 | }, 22 | "files": ["src/global.d.ts"] 23 | } 24 | -------------------------------------------------------------------------------- /website/.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | /node_modules 3 | 4 | # Production 5 | /build 6 | 7 | # Generated files 8 | .docusaurus 9 | .cache-loader 10 | 11 | # Misc 12 | .DS_Store 13 | .env.local 14 | .env.development.local 15 | .env.test.local 16 | .env.production.local 17 | 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* 21 | .yarn/* 22 | !.yarn/patches 23 | !.yarn/plugins 24 | !.yarn/releases 25 | !.yarn/sdks 26 | !.yarn/versions 27 | -------------------------------------------------------------------------------- /website/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')], 3 | }; 4 | -------------------------------------------------------------------------------- /website/docs/guides/absolute-imports.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: absolute-imports 3 | title: Absolute Imports 4 | --- 5 | 6 | If you wish to use TypeScript path mappings which are defined in `paths` of your tsconfig, make sure that you create the 7 | similar mapping for `moduleNameMapper` in Jest config. 8 | 9 | More information see `ts-jest` [paths mapping](https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping) configuration documentation 10 | -------------------------------------------------------------------------------- /website/docs/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: introduction 3 | title: Introduction 4 | description: Jest preset configuration for Angular projects. 5 | slug: / 6 | --- 7 | 8 | `jest-preset-angular` is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects. 9 | 10 | This is a part of the article: [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/). 11 | 12 | :::important 13 | 14 | Starting from **v9.0.0**, we follow closely native `Karma + Jasmine` implementation which is default provided by 15 | `@angular/cli`. This will make the testing experience with Jest more inline native with Angular testing experience. 16 | 17 | ::: 18 | -------------------------------------------------------------------------------- /website/docs/processing.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: processing 3 | title: Processing flow 4 | --- 5 | 6 | `jest-preset-angular` follows the processing flow of `ts-jest`, see more at https://kulshekhar.github.io/ts-jest/docs/processing 7 | -------------------------------------------------------------------------------- /website/sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": { 3 | "jest-preset-angular": [ 4 | "introduction", 5 | "processing" 6 | ], 7 | "Getting Started": [ 8 | "getting-started/installation", 9 | "getting-started/presets", 10 | "getting-started/options", 11 | "getting-started/test-environment", 12 | "getting-started/testbed-environment" 13 | ], 14 | "Guides": [ 15 | "guides/angular-ivy", 16 | "guides/angular-13+", 17 | "guides/esm-support", 18 | "guides/jsdom-environment", 19 | "guides/jsdom-version", 20 | "guides/snapshot-testing", 21 | "guides/using-with-babel", 22 | "guides/absolute-imports", 23 | "guides/troubleshooting" 24 | ] 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /website/static/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thymikee/jest-preset-angular/eefc72b40103a6e4156975df1f6f366f69af0172/website/static/.nojekyll -------------------------------------------------------------------------------- /website/static/img/documentation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thymikee/jest-preset-angular/eefc72b40103a6e4156975df1f6f366f69af0172/website/static/img/documentation.png -------------------------------------------------------------------------------- /website/static/img/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thymikee/jest-preset-angular/eefc72b40103a6e4156975df1f6f366f69af0172/website/static/img/github.png -------------------------------------------------------------------------------- /website/static/img/pull-request.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thymikee/jest-preset-angular/eefc72b40103a6e4156975df1f6f366f69af0172/website/static/img/pull-request.png -------------------------------------------------------------------------------- /website/static/img/troubleshooting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thymikee/jest-preset-angular/eefc72b40103a6e4156975df1f6f366f69af0172/website/static/img/troubleshooting.png -------------------------------------------------------------------------------- /website/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@docusaurus/tsconfig", 3 | "compilerOptions": { 4 | "baseUrl": "." 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /website/versioned_docs/version-10.x/getting-started/test-environment.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: test-environment 3 | title: Test environment 4 | --- 5 | 6 | If you look at [`setup-jest.ts`](https://github.com/thymikee/jest-preset-angular/blob/main/src/config/setup-jest.ts), 7 | what we're doing here is we're adding globals required by Angular. With the included [jest-zone-patch](https://github.com/thymikee/jest-preset-angular/tree/main/src/zone-patch) 8 | we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal. 9 | -------------------------------------------------------------------------------- /website/versioned_docs/version-10.x/guides/absolute-imports.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: absolute-imports 3 | title: Absolute Imports 4 | --- 5 | 6 | If you wish to use TypeScript path mappings which are defined in `paths` of your tsconfig, make sure that you create the 7 | similar mapping for `moduleNameMapper` in Jest config. 8 | 9 | More information see `ts-jest` [paths mapping](https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping) configuration documentation 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-10.x/guides/angular-ivy.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: angular-ivy 3 | title: Angular Ivy 4 | --- 5 | 6 | Starting from **v9.0.0+**, `jest-preset-angular` is fully compatible with Angular Ivy. To make sure that Jest uses the 7 | Angular Ivy, you must run `ngcc` before running tests. `ngcc` will transform all Angular-format packages to be compatible 8 | with Ivy compiler. 9 | 10 | `jest-preset-angular` also provides util script to help you to run `ngcc` with Jest but this script only works via the 11 | JavaScript version of Jest config 12 | 13 | ```js 14 | // jest.config.js 15 | require('jest-preset-angular/ngcc-jest-processor'); 16 | 17 | module.exports = { 18 | // [...] 19 | }; 20 | ``` 21 | -------------------------------------------------------------------------------- /website/versioned_docs/version-10.x/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: introduction 3 | title: Introduction 4 | description: Jest preset configuration for Angular projects. 5 | slug: / 6 | --- 7 | 8 | `jest-preset-angular` is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects. 9 | 10 | This is a part of the article: [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/). 11 | 12 | :::important 13 | 14 | Starting from **v9.0.0**, we follow closely native `Karma + Jasmine` implementation which is default provided by 15 | `@angular/cli`. This will make the testing experience with Jest more inline native with Angular testing experience. 16 | 17 | ::: 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-10.x/processing.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: processing 3 | title: Processing flow 4 | --- 5 | 6 | `jest-preset-angular` follows the processing flow of `ts-jest`, see more at https://kulshekhar.github.io/ts-jest/docs/processing 7 | -------------------------------------------------------------------------------- /website/versioned_docs/version-11.0/getting-started/test-environment.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: test-environment 3 | title: Test environment 4 | --- 5 | 6 | If you look at [`setup-jest.ts`](https://github.com/thymikee/jest-preset-angular/blob/main/src/config/setup-jest.ts), 7 | what we're doing here is we're adding globals required by Angular. With the included [jest-zone-patch](https://github.com/thymikee/jest-preset-angular/tree/main/src/zone-patch) 8 | we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal. 9 | -------------------------------------------------------------------------------- /website/versioned_docs/version-11.0/guides/absolute-imports.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: absolute-imports 3 | title: Absolute Imports 4 | --- 5 | 6 | If you wish to use TypeScript path mappings which are defined in `paths` of your tsconfig, make sure that you create the 7 | similar mapping for `moduleNameMapper` in Jest config. 8 | 9 | More information see `ts-jest` [paths mapping](https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping) configuration documentation 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-11.0/guides/angular-ivy.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: angular-ivy 3 | title: Angular Ivy 4 | --- 5 | 6 | Starting from **v9.0.0+**, `jest-preset-angular` is fully compatible with Angular Ivy. To make sure that Jest uses the 7 | Angular Ivy, you must run `ngcc` before running tests. `ngcc` will transform all Angular-format packages to be compatible 8 | with Ivy compiler. 9 | 10 | `jest-preset-angular` also provides util script to help you to run `ngcc` with Jest but this script only works via the 11 | JavaScript version of Jest config 12 | 13 | ```js 14 | // jest.config.js 15 | require('jest-preset-angular/ngcc-jest-processor'); 16 | 17 | module.exports = { 18 | // [...] 19 | }; 20 | ``` 21 | -------------------------------------------------------------------------------- /website/versioned_docs/version-11.0/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: introduction 3 | title: Introduction 4 | description: Jest preset configuration for Angular projects. 5 | slug: / 6 | --- 7 | 8 | `jest-preset-angular` is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects. 9 | 10 | This is a part of the article: [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/). 11 | 12 | :::important 13 | 14 | Starting from **v9.0.0**, we follow closely native `Karma + Jasmine` implementation which is default provided by 15 | `@angular/cli`. This will make the testing experience with Jest more inline native with Angular testing experience. 16 | 17 | ::: 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-11.0/processing.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: processing 3 | title: Processing flow 4 | --- 5 | 6 | `jest-preset-angular` follows the processing flow of `ts-jest`, see more at https://kulshekhar.github.io/ts-jest/docs/processing 7 | -------------------------------------------------------------------------------- /website/versioned_docs/version-11.1/getting-started/test-environment.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: test-environment 3 | title: Test environment 4 | --- 5 | 6 | If you look at [`setup-jest.ts`](https://github.com/thymikee/jest-preset-angular/blob/main/src/config/setup-jest.ts), 7 | what we're doing here is we're adding globals required by Angular. With the included [jest-zone-patch](https://github.com/thymikee/jest-preset-angular/tree/main/src/zone-patch) 8 | we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal. 9 | -------------------------------------------------------------------------------- /website/versioned_docs/version-11.1/guides/absolute-imports.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: absolute-imports 3 | title: Absolute Imports 4 | --- 5 | 6 | If you wish to use TypeScript path mappings which are defined in `paths` of your tsconfig, make sure that you create the 7 | similar mapping for `moduleNameMapper` in Jest config. 8 | 9 | More information see `ts-jest` [paths mapping](https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping) configuration documentation 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-11.1/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: introduction 3 | title: Introduction 4 | description: Jest preset configuration for Angular projects. 5 | slug: / 6 | --- 7 | 8 | `jest-preset-angular` is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects. 9 | 10 | This is a part of the article: [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/). 11 | 12 | :::important 13 | 14 | Starting from **v9.0.0**, we follow closely native `Karma + Jasmine` implementation which is default provided by 15 | `@angular/cli`. This will make the testing experience with Jest more inline native with Angular testing experience. 16 | 17 | ::: 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-11.1/processing.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: processing 3 | title: Processing flow 4 | --- 5 | 6 | `jest-preset-angular` follows the processing flow of `ts-jest`, see more at https://kulshekhar.github.io/ts-jest/docs/processing 7 | -------------------------------------------------------------------------------- /website/versioned_docs/version-12.0/guides/absolute-imports.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: absolute-imports 3 | title: Absolute Imports 4 | --- 5 | 6 | If you wish to use TypeScript path mappings which are defined in `paths` of your tsconfig, make sure that you create the 7 | similar mapping for `moduleNameMapper` in Jest config. 8 | 9 | More information see `ts-jest` [paths mapping](https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping) configuration documentation 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-12.0/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: introduction 3 | title: Introduction 4 | description: Jest preset configuration for Angular projects. 5 | slug: / 6 | --- 7 | 8 | `jest-preset-angular` is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects. 9 | 10 | This is a part of the article: [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/). 11 | 12 | :::important 13 | 14 | Starting from **v9.0.0**, we follow closely native `Karma + Jasmine` implementation which is default provided by 15 | `@angular/cli`. This will make the testing experience with Jest more inline native with Angular testing experience. 16 | 17 | ::: 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-12.0/processing.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: processing 3 | title: Processing flow 4 | --- 5 | 6 | `jest-preset-angular` follows the processing flow of `ts-jest`, see more at https://kulshekhar.github.io/ts-jest/docs/processing 7 | -------------------------------------------------------------------------------- /website/versioned_docs/version-13.0/guides/absolute-imports.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: absolute-imports 3 | title: Absolute Imports 4 | --- 5 | 6 | If you wish to use TypeScript path mappings which are defined in `paths` of your tsconfig, make sure that you create the 7 | similar mapping for `moduleNameMapper` in Jest config. 8 | 9 | More information see `ts-jest` [paths mapping](https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping) configuration documentation 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-13.0/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: introduction 3 | title: Introduction 4 | description: Jest preset configuration for Angular projects. 5 | slug: / 6 | --- 7 | 8 | `jest-preset-angular` is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects. 9 | 10 | This is a part of the article: [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/). 11 | 12 | :::important 13 | 14 | Starting from **v9.0.0**, we follow closely native `Karma + Jasmine` implementation which is default provided by 15 | `@angular/cli`. This will make the testing experience with Jest more inline native with Angular testing experience. 16 | 17 | ::: 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-13.0/processing.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: processing 3 | title: Processing flow 4 | --- 5 | 6 | `jest-preset-angular` follows the processing flow of `ts-jest`, see more at https://kulshekhar.github.io/ts-jest/docs/processing 7 | -------------------------------------------------------------------------------- /website/versioned_docs/version-14.0/guides/absolute-imports.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: absolute-imports 3 | title: Absolute Imports 4 | --- 5 | 6 | If you wish to use TypeScript path mappings which are defined in `paths` of your tsconfig, make sure that you create the 7 | similar mapping for `moduleNameMapper` in Jest config. 8 | 9 | More information see `ts-jest` [paths mapping](https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping) configuration documentation 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-14.0/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: introduction 3 | title: Introduction 4 | description: Jest preset configuration for Angular projects. 5 | slug: / 6 | --- 7 | 8 | `jest-preset-angular` is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects. 9 | 10 | This is a part of the article: [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/). 11 | 12 | :::important 13 | 14 | Starting from **v9.0.0**, we follow closely native `Karma + Jasmine` implementation which is default provided by 15 | `@angular/cli`. This will make the testing experience with Jest more inline native with Angular testing experience. 16 | 17 | ::: 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-14.0/processing.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: processing 3 | title: Processing flow 4 | --- 5 | 6 | `jest-preset-angular` follows the processing flow of `ts-jest`, see more at https://kulshekhar.github.io/ts-jest/docs/processing 7 | -------------------------------------------------------------------------------- /website/versioned_docs/version-14.2/guides/absolute-imports.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: absolute-imports 3 | title: Absolute Imports 4 | --- 5 | 6 | If you wish to use TypeScript path mappings which are defined in `paths` of your tsconfig, make sure that you create the 7 | similar mapping for `moduleNameMapper` in Jest config. 8 | 9 | More information see `ts-jest` [paths mapping](https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping) configuration documentation 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-14.2/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: introduction 3 | title: Introduction 4 | description: Jest preset configuration for Angular projects. 5 | slug: / 6 | --- 7 | 8 | `jest-preset-angular` is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects. 9 | 10 | This is a part of the article: [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/). 11 | 12 | :::important 13 | 14 | Starting from **v9.0.0**, we follow closely native `Karma + Jasmine` implementation which is default provided by 15 | `@angular/cli`. This will make the testing experience with Jest more inline native with Angular testing experience. 16 | 17 | ::: 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-14.2/processing.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: processing 3 | title: Processing flow 4 | --- 5 | 6 | `jest-preset-angular` follows the processing flow of `ts-jest`, see more at https://kulshekhar.github.io/ts-jest/docs/processing 7 | -------------------------------------------------------------------------------- /website/versioned_docs/version-14.3/guides/absolute-imports.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: absolute-imports 3 | title: Absolute Imports 4 | --- 5 | 6 | If you wish to use TypeScript path mappings which are defined in `paths` of your tsconfig, make sure that you create the 7 | similar mapping for `moduleNameMapper` in Jest config. 8 | 9 | More information see `ts-jest` [paths mapping](https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping) configuration documentation 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-14.3/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: introduction 3 | title: Introduction 4 | description: Jest preset configuration for Angular projects. 5 | slug: / 6 | --- 7 | 8 | `jest-preset-angular` is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects. 9 | 10 | This is a part of the article: [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/). 11 | 12 | :::important 13 | 14 | Starting from **v9.0.0**, we follow closely native `Karma + Jasmine` implementation which is default provided by 15 | `@angular/cli`. This will make the testing experience with Jest more inline native with Angular testing experience. 16 | 17 | ::: 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-14.3/processing.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: processing 3 | title: Processing flow 4 | --- 5 | 6 | `jest-preset-angular` follows the processing flow of `ts-jest`, see more at https://kulshekhar.github.io/ts-jest/docs/processing 7 | -------------------------------------------------------------------------------- /website/versioned_docs/version-14.4/guides/absolute-imports.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: absolute-imports 3 | title: Absolute Imports 4 | --- 5 | 6 | If you wish to use TypeScript path mappings which are defined in `paths` of your tsconfig, make sure that you create the 7 | similar mapping for `moduleNameMapper` in Jest config. 8 | 9 | More information see `ts-jest` [paths mapping](https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping) configuration documentation 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-14.4/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: introduction 3 | title: Introduction 4 | description: Jest preset configuration for Angular projects. 5 | slug: / 6 | --- 7 | 8 | `jest-preset-angular` is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects. 9 | 10 | This is a part of the article: [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/). 11 | 12 | :::important 13 | 14 | Starting from **v9.0.0**, we follow closely native `Karma + Jasmine` implementation which is default provided by 15 | `@angular/cli`. This will make the testing experience with Jest more inline native with Angular testing experience. 16 | 17 | ::: 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-14.4/processing.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: processing 3 | title: Processing flow 4 | --- 5 | 6 | `jest-preset-angular` follows the processing flow of `ts-jest`, see more at https://kulshekhar.github.io/ts-jest/docs/processing 7 | -------------------------------------------------------------------------------- /website/versioned_docs/version-14.5/guides/absolute-imports.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: absolute-imports 3 | title: Absolute Imports 4 | --- 5 | 6 | If you wish to use TypeScript path mappings which are defined in `paths` of your tsconfig, make sure that you create the 7 | similar mapping for `moduleNameMapper` in Jest config. 8 | 9 | More information see `ts-jest` [paths mapping](https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping) configuration documentation 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-14.5/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: introduction 3 | title: Introduction 4 | description: Jest preset configuration for Angular projects. 5 | slug: / 6 | --- 7 | 8 | `jest-preset-angular` is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects. 9 | 10 | This is a part of the article: [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/). 11 | 12 | :::important 13 | 14 | Starting from **v9.0.0**, we follow closely native `Karma + Jasmine` implementation which is default provided by 15 | `@angular/cli`. This will make the testing experience with Jest more inline native with Angular testing experience. 16 | 17 | ::: 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-14.5/processing.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: processing 3 | title: Processing flow 4 | --- 5 | 6 | `jest-preset-angular` follows the processing flow of `ts-jest`, see more at https://kulshekhar.github.io/ts-jest/docs/processing 7 | -------------------------------------------------------------------------------- /website/versioned_docs/version-14.6/guides/absolute-imports.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: absolute-imports 3 | title: Absolute Imports 4 | --- 5 | 6 | If you wish to use TypeScript path mappings which are defined in `paths` of your tsconfig, make sure that you create the 7 | similar mapping for `moduleNameMapper` in Jest config. 8 | 9 | More information see `ts-jest` [paths mapping](https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping) configuration documentation 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-14.6/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: introduction 3 | title: Introduction 4 | description: Jest preset configuration for Angular projects. 5 | slug: / 6 | --- 7 | 8 | `jest-preset-angular` is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects. 9 | 10 | This is a part of the article: [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/). 11 | 12 | :::important 13 | 14 | Starting from **v9.0.0**, we follow closely native `Karma + Jasmine` implementation which is default provided by 15 | `@angular/cli`. This will make the testing experience with Jest more inline native with Angular testing experience. 16 | 17 | ::: 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-14.6/processing.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: processing 3 | title: Processing flow 4 | --- 5 | 6 | `jest-preset-angular` follows the processing flow of `ts-jest`, see more at https://kulshekhar.github.io/ts-jest/docs/processing 7 | -------------------------------------------------------------------------------- /website/versioned_docs/version-8.x/getting-started/test-environment.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: test-environment 3 | title: Test environment 4 | --- 5 | 6 | If you look at [`setup-jest.ts`](https://github.com/thymikee/jest-preset-angular/blob/v8.3.2/src/setup-jest.ts), 7 | what we're doing here is we're adding globals required by Angular. With the included [jest-zone-patch](https://github.com/thymikee/jest-preset-angular/tree/v8.3.2/src/zone-patch) 8 | we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal. 9 | -------------------------------------------------------------------------------- /website/versioned_docs/version-8.x/guides/angular-ivy.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: angular-ivy 3 | title: Angular Ivy 4 | --- 5 | 6 | Currently, `jest-preset-angular` is partially compatible with Angular Ivy. To make sure that Jest uses the Angular Ivy, 7 | you must run `ngcc` before running tests. `ngcc` will transform all Angular-format packages to be compatible 8 | with Ivy compiler. 9 | 10 | `jest-preset-angular` also provides util script to help you to run `ngcc` with Jest but this script only works via the 11 | JavaScript version of Jest config 12 | 13 | ```js 14 | // jest.config.js 15 | require('jest-preset-angular/ngcc-jest-processor'); 16 | 17 | module.exports = { 18 | // [...] 19 | }; 20 | ``` 21 | -------------------------------------------------------------------------------- /website/versioned_docs/version-8.x/guides/esm-support.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: esm-support 3 | title: ESM Support 4 | --- 5 | 6 | :::important 7 | 8 | ESM support is only available in **v9.0.0++** 9 | 10 | ::: 11 | -------------------------------------------------------------------------------- /website/versioned_docs/version-8.x/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: introduction 3 | title: Introduction 4 | description: Jest preset configuration for Angular projects. 5 | slug: / 6 | --- 7 | 8 | `jest-preset-angular` is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects. 9 | 10 | This is a part of the article: [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/). 11 | -------------------------------------------------------------------------------- /website/versioned_docs/version-8.x/processing.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: processing 3 | title: Processing flow 4 | --- 5 | 6 | `jest-preset-angular` follows the processing flow of `ts-jest`, see more at https://kulshekhar.github.io/ts-jest/docs/processing 7 | -------------------------------------------------------------------------------- /website/versioned_docs/version-9.x/getting-started/test-environment.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: test-environment 3 | title: Test environment 4 | --- 5 | 6 | If you look at [`setup-jest.ts`](https://github.com/thymikee/jest-preset-angular/blob/main/src/config/setup-jest.ts), 7 | what we're doing here is we're adding globals required by Angular. With the included [jest-zone-patch](https://github.com/thymikee/jest-preset-angular/tree/main/src/zone-patch) 8 | we also make sure Jest test methods run in Zone context. Then we initialize the Angular testing environment like normal. 9 | -------------------------------------------------------------------------------- /website/versioned_docs/version-9.x/guides/absolute-imports.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: absolute-imports 3 | title: Absolute Imports 4 | --- 5 | 6 | If you wish to use TypeScript path mappings which are defined in `paths` of your tsconfig, make sure that you create the 7 | similar mapping for `moduleNameMapper` in Jest config. 8 | 9 | More information see `ts-jest` [paths mapping](https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping) configuration documentation 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-9.x/guides/angular-ivy.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: angular-ivy 3 | title: Angular Ivy 4 | --- 5 | 6 | Starting from **v9.0.0+**, `jest-preset-angular` is fully compatible with Angular Ivy. To make sure that Jest uses the 7 | Angular Ivy, you must run `ngcc` before running tests. `ngcc` will transform all Angular-format packages to be compatible 8 | with Ivy compiler. 9 | 10 | `jest-preset-angular` also provides util script to help you to run `ngcc` with Jest but this script only works via the 11 | JavaScript version of Jest config 12 | 13 | ```js 14 | // jest.config.js 15 | require('jest-preset-angular/ngcc-jest-processor'); 16 | 17 | module.exports = { 18 | // [...] 19 | }; 20 | ``` 21 | -------------------------------------------------------------------------------- /website/versioned_docs/version-9.x/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: introduction 3 | title: Introduction 4 | description: Jest preset configuration for Angular projects. 5 | slug: / 6 | --- 7 | 8 | `jest-preset-angular` is Jest preset configuration and TypeScript preprocessor with source map support for Jest that lets you use Jest to test Angular projects. 9 | 10 | This is a part of the article: [Testing Angular faster with Jest](https://www.xfive.co/blog/testing-angular-faster-jest/). 11 | 12 | :::important 13 | 14 | Starting from **v9.0.0**, we follow closely native `Karma + Jasmine` implementation which is default provided by 15 | `@angular/cli`. This will make the testing experience with Jest more inline native with Angular testing experience. 16 | 17 | ::: 18 | -------------------------------------------------------------------------------- /website/versioned_docs/version-9.x/processing.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: processing 3 | title: Processing flow 4 | --- 5 | 6 | `jest-preset-angular` follows the processing flow of `ts-jest`, see more at https://kulshekhar.github.io/ts-jest/docs/processing 7 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-10.x-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": { 3 | "jest-preset-angular": [ 4 | "introduction", 5 | "processing" 6 | ], 7 | "Getting Started": [ 8 | "getting-started/installation", 9 | "getting-started/presets", 10 | "getting-started/options", 11 | "getting-started/test-environment" 12 | ], 13 | "Guides": [ 14 | "guides/angular-ivy", 15 | "guides/esm-support", 16 | "guides/jsdom-version", 17 | "guides/using-with-babel", 18 | "guides/absolute-imports", 19 | "guides/troubleshooting" 20 | ] 21 | } 22 | } -------------------------------------------------------------------------------- /website/versioned_sidebars/version-11.0-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": { 3 | "jest-preset-angular": [ 4 | "introduction", 5 | "processing" 6 | ], 7 | "Getting Started": [ 8 | "getting-started/installation", 9 | "getting-started/presets", 10 | "getting-started/options", 11 | "getting-started/test-environment" 12 | ], 13 | "Guides": [ 14 | "guides/angular-ivy", 15 | "guides/angular-13+", 16 | "guides/esm-support", 17 | "guides/jsdom-version", 18 | "guides/using-with-babel", 19 | "guides/absolute-imports", 20 | "guides/troubleshooting" 21 | ] 22 | } 23 | } -------------------------------------------------------------------------------- /website/versioned_sidebars/version-11.1-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": { 3 | "jest-preset-angular": [ 4 | "introduction", 5 | "processing" 6 | ], 7 | "Getting Started": [ 8 | "getting-started/installation", 9 | "getting-started/presets", 10 | "getting-started/options", 11 | "getting-started/test-environment" 12 | ], 13 | "Guides": [ 14 | "guides/angular-ivy", 15 | "guides/angular-13+", 16 | "guides/esm-support", 17 | "guides/jsdom-version", 18 | "guides/using-with-babel", 19 | "guides/absolute-imports", 20 | "guides/troubleshooting" 21 | ] 22 | } 23 | } -------------------------------------------------------------------------------- /website/versioned_sidebars/version-12.0-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": { 3 | "jest-preset-angular": [ 4 | "introduction", 5 | "processing" 6 | ], 7 | "Getting Started": [ 8 | "getting-started/installation", 9 | "getting-started/presets", 10 | "getting-started/options", 11 | "getting-started/test-environment" 12 | ], 13 | "Guides": [ 14 | "guides/angular-ivy", 15 | "guides/angular-13+", 16 | "guides/esm-support", 17 | "guides/jsdom-version", 18 | "guides/using-with-babel", 19 | "guides/absolute-imports", 20 | "guides/troubleshooting" 21 | ] 22 | } 23 | } -------------------------------------------------------------------------------- /website/versioned_sidebars/version-13.0-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": { 3 | "jest-preset-angular": [ 4 | "introduction", 5 | "processing" 6 | ], 7 | "Getting Started": [ 8 | "getting-started/installation", 9 | "getting-started/presets", 10 | "getting-started/options", 11 | "getting-started/test-environment" 12 | ], 13 | "Guides": [ 14 | "guides/angular-ivy", 15 | "guides/angular-13+", 16 | "guides/esm-support", 17 | "guides/jsdom-version", 18 | "guides/using-with-babel", 19 | "guides/absolute-imports", 20 | "guides/troubleshooting" 21 | ] 22 | } 23 | } -------------------------------------------------------------------------------- /website/versioned_sidebars/version-14.0-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": { 3 | "jest-preset-angular": [ 4 | "introduction", 5 | "processing" 6 | ], 7 | "Getting Started": [ 8 | "getting-started/installation", 9 | "getting-started/presets", 10 | "getting-started/options", 11 | "getting-started/test-environment" 12 | ], 13 | "Guides": [ 14 | "guides/angular-ivy", 15 | "guides/angular-13+", 16 | "guides/esm-support", 17 | "guides/jsdom-version", 18 | "guides/using-with-babel", 19 | "guides/absolute-imports", 20 | "guides/troubleshooting" 21 | ] 22 | } 23 | } -------------------------------------------------------------------------------- /website/versioned_sidebars/version-14.2-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": { 3 | "jest-preset-angular": [ 4 | "introduction", 5 | "processing" 6 | ], 7 | "Getting Started": [ 8 | "getting-started/installation", 9 | "getting-started/presets", 10 | "getting-started/options", 11 | "getting-started/test-environment" 12 | ], 13 | "Guides": [ 14 | "guides/angular-ivy", 15 | "guides/angular-13+", 16 | "guides/esm-support", 17 | "guides/jsdom-version", 18 | "guides/snapshot-testing", 19 | "guides/using-with-babel", 20 | "guides/absolute-imports", 21 | "guides/troubleshooting" 22 | ] 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-14.3-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": { 3 | "jest-preset-angular": [ 4 | "introduction", 5 | "processing" 6 | ], 7 | "Getting Started": [ 8 | "getting-started/installation", 9 | "getting-started/presets", 10 | "getting-started/options", 11 | "getting-started/test-environment" 12 | ], 13 | "Guides": [ 14 | "guides/angular-ivy", 15 | "guides/angular-13+", 16 | "guides/esm-support", 17 | "guides/jsdom-version", 18 | "guides/snapshot-testing", 19 | "guides/using-with-babel", 20 | "guides/absolute-imports", 21 | "guides/troubleshooting" 22 | ] 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-14.4-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": { 3 | "jest-preset-angular": [ 4 | "introduction", 5 | "processing" 6 | ], 7 | "Getting Started": [ 8 | "getting-started/installation", 9 | "getting-started/presets", 10 | "getting-started/options", 11 | "getting-started/test-environment" 12 | ], 13 | "Guides": [ 14 | "guides/angular-ivy", 15 | "guides/angular-13+", 16 | "guides/esm-support", 17 | "guides/jsdom-version", 18 | "guides/snapshot-testing", 19 | "guides/using-with-babel", 20 | "guides/absolute-imports", 21 | "guides/troubleshooting" 22 | ] 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-8.x-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": { 3 | "jest-preset-angular": [ 4 | "introduction", 5 | "processing" 6 | ], 7 | "Getting Started": [ 8 | "getting-started/installation", 9 | "getting-started/presets", 10 | "getting-started/options", 11 | "getting-started/test-environment" 12 | ], 13 | "Guides": [ 14 | "guides/angular-ivy", 15 | "guides/esm-support", 16 | "guides/jsdom-version", 17 | "guides/using-with-babel", 18 | "guides/absolute-imports", 19 | "guides/troubleshooting" 20 | ] 21 | } 22 | } -------------------------------------------------------------------------------- /website/versioned_sidebars/version-9.x-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": { 3 | "jest-preset-angular": [ 4 | "introduction", 5 | "processing" 6 | ], 7 | "Getting Started": [ 8 | "getting-started/installation", 9 | "getting-started/presets", 10 | "getting-started/options", 11 | "getting-started/test-environment" 12 | ], 13 | "Guides": [ 14 | "guides/angular-ivy", 15 | "guides/esm-support", 16 | "guides/jsdom-version", 17 | "guides/using-with-babel", 18 | "guides/absolute-imports", 19 | "guides/troubleshooting" 20 | ] 21 | } 22 | } -------------------------------------------------------------------------------- /website/versions.json: -------------------------------------------------------------------------------- 1 | [ 2 | "14.6", 3 | "14.5", 4 | "14.4", 5 | "14.3", 6 | "14.2", 7 | "14.0", 8 | "13.0", 9 | "12.0", 10 | "11.1", 11 | "11.0", 12 | "10.x", 13 | "9.x", 14 | "8.x" 15 | ] 16 | --------------------------------------------------------------------------------