From b02ff76655137c05a76793b27591bedb63599b7c Mon Sep 17 00:00:00 2001 From: Arjen Date: Tue, 23 Nov 2021 17:33:12 +0100 Subject: [PATCH] chore: update nx and angular 13 (#260) BREAKING CHANGE: This version requires the following versions: - Angular v13 --- .gitignore | 3 + .husky/.gitignore | 1 - .nxignore | 1 + .prettierignore | 2 + angular.json | 296 ------------------ apps/example-app-karma/project.json | 82 +++++ .../src/environments/environment.ts | 2 +- apps/example-app-karma/src/polyfills.ts | 10 - apps/example-app-karma/src/test.ts | 2 +- apps/example-app-karma/tsconfig.app.json | 4 +- apps/example-app-karma/tsconfig.json | 2 +- apps/example-app/project.json | 82 +++++ apps/example-app/src/app/examples/03-forms.ts | 3 + .../app/examples/04-forms-with-material.ts | 3 + apps/example-app/src/polyfills.ts | 10 - apps/example-app/tsconfig.app.json | 4 +- apps/example-app/tsconfig.json | 2 +- apps/example-app/tsconfig.spec.json | 2 +- decorate-angular-cli.js | 69 ++++ jest.preset.js | 8 +- nx.json | 81 +++-- package.json | 121 +++---- projects/jest-utils/package.json | 2 +- projects/jest-utils/project.json | 54 ++++ projects/jest-utils/src/lib/create-mock.ts | 2 +- projects/jest-utils/tests/create-mock.spec.ts | 10 +- projects/jest-utils/tsconfig.json | 24 ++ projects/jest-utils/tsconfig.lib.json | 26 +- projects/jest-utils/tsconfig.lib.prod.json | 9 + projects/jest-utils/tsconfig.spec.json | 4 +- projects/testing-library/package.json | 10 +- projects/testing-library/project.json | 60 ++++ projects/testing-library/tests/render.spec.ts | 2 +- projects/testing-library/tsconfig.json | 24 ++ projects/testing-library/tsconfig.lib.json | 25 +- .../testing-library/tsconfig.lib.prod.json | 9 + .../testing-library/tsconfig.schematics.json | 2 +- projects/testing-library/tsconfig.spec.json | 4 +- .../vscode-atl-render/.vscode/launch.json | 22 +- tsconfig.json => tsconfig.base.json | 16 +- workspace.json | 9 + 41 files changed, 623 insertions(+), 481 deletions(-) delete mode 100644 .husky/.gitignore create mode 100644 .nxignore delete mode 100644 angular.json create mode 100644 apps/example-app-karma/project.json create mode 100644 apps/example-app/project.json create mode 100644 decorate-angular-cli.js create mode 100644 projects/jest-utils/project.json create mode 100644 projects/jest-utils/tsconfig.json create mode 100644 projects/jest-utils/tsconfig.lib.prod.json create mode 100644 projects/testing-library/project.json create mode 100644 projects/testing-library/tsconfig.json create mode 100644 projects/testing-library/tsconfig.lib.prod.json rename tsconfig.json => tsconfig.base.json (73%) create mode 100644 workspace.json diff --git a/.gitignore b/.gitignore index 82985ca5..b1a42cd6 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,9 @@ !.vscode/extensions.json # misc +/.angular/cache +.angular +.cache /.sass-cache /connect.lock /coverage diff --git a/.husky/.gitignore b/.husky/.gitignore deleted file mode 100644 index 31354ec1..00000000 --- a/.husky/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_ diff --git a/.nxignore b/.nxignore new file mode 100644 index 00000000..aeb6b7f1 --- /dev/null +++ b/.nxignore @@ -0,0 +1 @@ +/projects/vscode-atl-render diff --git a/.prettierignore b/.prettierignore index 2cbf2c26..9aa8a3df 100644 --- a/.prettierignore +++ b/.prettierignore @@ -35,6 +35,8 @@ CHANGELOG.md !.vscode/extensions.json # misc +.cache +.angular /.sass-cache /connect.lock /coverage diff --git a/angular.json b/angular.json deleted file mode 100644 index 50afdec9..00000000 --- a/angular.json +++ /dev/null @@ -1,296 +0,0 @@ -{ - "version": 1, - "cli": { - "analytics": false - }, - "defaultProject": "example-app", - "projects": { - "example-app": { - "projectType": "application", - "root": "apps/example-app", - "sourceRoot": "apps/example-app/src", - "prefix": "app", - "schematics": {}, - "architect": { - "build": { - "builder": "@angular-devkit/build-angular:browser", - "options": { - "outputPath": "dist/apps/example-app", - "index": "apps/example-app/src/index.html", - "main": "apps/example-app/src/main.ts", - "polyfills": "apps/example-app/src/polyfills.ts", - "tsConfig": "apps/example-app/tsconfig.app.json", - "assets": ["apps/example-app/src/favicon.ico", "apps/example-app/src/assets"], - "styles": ["apps/example-app/src/styles.css"], - "scripts": [], - "vendorChunk": true, - "extractLicenses": false, - "buildOptimizer": false, - "sourceMap": true, - "optimization": false, - "namedChunks": true - }, - "configurations": { - "production": { - "budgets": [ - { - "type": "anyComponentStyle", - "maximumWarning": "6kb" - } - ], - "fileReplacements": [ - { - "replace": "apps/example-app/src/environments/environment.ts", - "with": "apps/example-app/src/environments/environment.prod.ts" - } - ], - "optimization": true, - "outputHashing": "all", - "sourceMap": false, - "namedChunks": false, - "extractLicenses": true, - "vendorChunk": false, - "buildOptimizer": true - } - }, - "outputs": ["{options.outputPath}"] - }, - "serve": { - "builder": "@angular-devkit/build-angular:dev-server", - "options": { - "browserTarget": "example-app:build" - }, - "configurations": { - "production": { - "browserTarget": "example-app:build:production" - } - } - }, - "extract-i18n": { - "builder": "@angular-devkit/build-angular:extract-i18n", - "options": { - "browserTarget": "example-app:build" - } - }, - "lint": { - "builder": "@nrwl/linter:eslint", - "options": { - "lintFilePatterns": [ - "apps/example-app/**/*.ts", - "apps/example-app/**/*.html", - "apps/example-app/src/**/*.html", - "apps/example-app/src/**/*.html", - "apps/example-app/src/**/*.html" - ] - }, - "outputs": ["{options.outputFile}"] - }, - "test": { - "builder": "@nrwl/jest:jest", - "options": { - "jestConfig": "apps/example-app/jest.config.js" - }, - "outputs": ["coverage/"] - } - } - }, - "example-app-karma": { - "projectType": "application", - "root": "apps/example-app-karma", - "sourceRoot": "apps/example-app-karma/src", - "prefix": "app", - "schematics": {}, - "architect": { - "build": { - "builder": "@angular-devkit/build-angular:browser", - "options": { - "outputPath": "dist/apps/example-app-karma", - "index": "apps/example-app-karma/src/index.html", - "main": "apps/example-app-karma/src/main.ts", - "polyfills": "apps/example-app-karma/src/polyfills.ts", - "tsConfig": "apps/example-app-karma/tsconfig.app.json", - "assets": ["apps/example-app-karma/src/favicon.ico", "apps/example-app-karma/src/assets"], - "styles": [], - "scripts": [], - "vendorChunk": true, - "extractLicenses": false, - "buildOptimizer": false, - "sourceMap": true, - "optimization": false, - "namedChunks": true - }, - "configurations": { - "production": { - "budgets": [ - { - "type": "anyComponentStyle", - "maximumWarning": "6kb" - } - ], - "fileReplacements": [ - { - "replace": "apps/example-app-karma/src/environments/environment.ts", - "with": "apps/example-app-karma/src/environments/environment.prod.ts" - } - ], - "optimization": true, - "outputHashing": "all", - "sourceMap": false, - "namedChunks": false, - "extractLicenses": true, - "vendorChunk": false, - "buildOptimizer": true - } - }, - "outputs": ["{options.outputPath}"] - }, - "serve": { - "builder": "@angular-devkit/build-angular:dev-server", - "options": { - "browserTarget": "example-app-karma:build" - }, - "configurations": { - "production": { - "browserTarget": "example-app-karma:build:production" - } - } - }, - "lint": { - "builder": "@nrwl/linter:eslint", - "options": { - "lintFilePatterns": [ - "apps/example-app-karma/**/*.ts", - "apps/example-app-karma/**/*.html", - "apps/example-app-karma/src/**/*.html", - "apps/example-app-karma/src/**/*.html", - "apps/example-app-karma/src/**/*.html" - ] - }, - "outputs": ["{options.outputFile}"] - }, - "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "main": "apps/example-app-karma/src/test.ts", - "tsConfig": "apps/example-app-karma/tsconfig.spec.json", - "polyfills": "apps/example-app-karma/src/polyfills.ts", - "karmaConfig": "apps/example-app-karma/karma.conf.js", - "styles": [], - "scripts": [], - "assets": [] - } - } - } - }, - "jest-utils": { - "root": "projects/jest-utils", - "sourceRoot": "projects/jest-utils/src", - "projectType": "library", - "prefix": "lib", - "architect": { - "build-package": { - "builder": "@angular-devkit/build-angular:ng-packagr", - "options": { - "tsConfig": "projects/jest-utils/tsconfig.lib.json", - "project": "projects/jest-utils/ng-package.json" - }, - "configurations": { - "production": { - "project": "projects/jest-utils/ng-package.json", - "tsConfig": "projects/jest-utils/tsconfig.lib.json" - } - } - }, - "lint": { - "builder": "@nrwl/linter:eslint", - "options": { - "lintFilePatterns": [ - "projects/jest-utils/**/*.ts", - "projects/jest-utils/**/*.html", - "projects/jest-utils/src/**/*.html", - "projects/jest-utils/src/**/*.html", - "projects/jest-utils/src/**/*.html" - ] - }, - "outputs": ["{options.outputFile}"] - }, - "build": { - "builder": "@nrwl/workspace:run-commands", - "options": { - "parallel": false, - "commands": [ - { - "command": "ng run jest-utils:build-package" - } - ] - } - }, - "test": { - "builder": "@nrwl/jest:jest", - "options": { - "jestConfig": "projects/jest-utils/jest.config.js" - }, - "outputs": ["coverage/projects/jest-utils"] - } - } - }, - "testing-library": { - "root": "projects/testing-library", - "sourceRoot": "projects/testing-library/src", - "projectType": "library", - "prefix": "lib", - "architect": { - "build-package": { - "builder": "@angular-devkit/build-angular:ng-packagr", - "options": { - "tsConfig": "projects/testing-library/tsconfig.lib.json", - "project": "projects/testing-library/ng-package.json" - }, - "configurations": { - "production": { - "project": "projects/testing-library/ng-package.json", - "tsConfig": "projects/testing-library/tsconfig.lib.json" - } - } - }, - "lint": { - "builder": "@nrwl/linter:eslint", - "options": { - "lintFilePatterns": [ - "projects/testing-library/**/*.ts", - "projects/testing-library/**/*.html", - "projects/testing-library/src/**/*.html", - "projects/testing-library/src/**/*.html", - "projects/testing-library/src/**/*.html" - ] - }, - "outputs": ["{options.outputFile}"] - }, - "build": { - "builder": "@nrwl/workspace:run-commands", - "options": { - "parallel": false, - "commands": [ - { - "command": "ng run testing-library:build-package" - }, - { - "command": "npm run build:schematics" - }, - { - "command": "cpy ./README.md ./dist/@testing-library/angular" - } - ] - } - }, - "test": { - "builder": "@nrwl/jest:jest", - "options": { - "jestConfig": "projects/testing-library/jest.config.js" - }, - "outputs": ["coverage/projects/testing-library"] - } - } - } - } -} diff --git a/apps/example-app-karma/project.json b/apps/example-app-karma/project.json new file mode 100644 index 00000000..94b4a463 --- /dev/null +++ b/apps/example-app-karma/project.json @@ -0,0 +1,82 @@ +{ + "projectType": "application", + "root": "apps/example-app-karma", + "sourceRoot": "apps/example-app-karma/src", + "prefix": "app", + "generators": {}, + "targets": { + "build": { + "executor": "@angular-devkit/build-angular:browser", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/apps/example-app-karma", + "index": "apps/example-app-karma/src/index.html", + "main": "apps/example-app-karma/src/main.ts", + "polyfills": "apps/example-app-karma/src/polyfills.ts", + "tsConfig": "apps/example-app-karma/tsconfig.app.json", + "assets": ["apps/example-app-karma/src/favicon.ico", "apps/example-app-karma/src/assets"], + "styles": [], + "scripts": [] + }, + "configurations": { + "production": { + "budgets": [ + { + "type": "anyComponentStyle", + "maximumWarning": "6kb" + } + ], + "fileReplacements": [ + { + "replace": "apps/example-app-karma/src/environments/environment.ts", + "with": "apps/example-app-karma/src/environments/environment.prod.ts" + } + ], + "outputHashing": "all" + }, + "development": { + "buildOptimizer": false, + "optimization": false, + "vendorChunk": true, + "extractLicenses": false, + "sourceMap": true, + "namedChunks": true + } + }, + "defaultConfiguration": "production" + }, + "serve": { + "executor": "@angular-devkit/build-angular:dev-server", + "configurations": { + "production": { + "browserTarget": "example-app-karma:build:production" + }, + "development": { + "browserTarget": "example-app-karma:build:development" + } + }, + "defaultConfiguration": "development" + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": [ + "apps/example-app-karma/**/*.ts", + "apps/example-app-karma/**/*.html", + "apps/example-app-karma/src/**/*.html" + ] + }, + "outputs": ["{options.outputFile}"] + }, + "test": { + "executor": "@angular-devkit/build-angular:karma", + "options": { + "main": "apps/example-app-karma/src/test.ts", + "tsConfig": "apps/example-app-karma/tsconfig.spec.json", + "polyfills": "apps/example-app-karma/src/polyfills.ts", + "karmaConfig": "apps/example-app-karma/karma.conf.js" + } + } + }, + "tags": [] +} diff --git a/apps/example-app-karma/src/environments/environment.ts b/apps/example-app-karma/src/environments/environment.ts index 85db3caf..64c3e6c7 100644 --- a/apps/example-app-karma/src/environments/environment.ts +++ b/apps/example-app-karma/src/environments/environment.ts @@ -1,6 +1,6 @@ // This file can be replaced during build by using the `fileReplacements` array. // `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`. -// The list of file replacements can be found in `angular.json`. +// The list of file replacements can be found in `workspace.json`. export const environment = { production: false, diff --git a/apps/example-app-karma/src/polyfills.ts b/apps/example-app-karma/src/polyfills.ts index bb20fec0..f84fd8a6 100644 --- a/apps/example-app-karma/src/polyfills.ts +++ b/apps/example-app-karma/src/polyfills.ts @@ -34,22 +34,12 @@ // import 'core-js/es6/weak-map'; // import 'core-js/es6/set'; -/** IE10 and IE11 requires the following for NgClass support on SVG elements */ -// import 'classlist.js'; // Run `npm install --save classlist.js`. - /** IE10 and IE11 requires the following for the Reflect API. */ // import 'core-js/es6/reflect'; /** Evergreen browsers require these. **/ // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. -/** - * Web Animations `@angular/platform-browser/animations` - * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. - * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). - **/ -// import 'web-animations-js'; // Run `npm install --save web-animations-js`. - /** * By default, zone.js will patch all possible macroTask and DomEvents * user can disable parts of macroTask/DomEvents patch by setting following flags diff --git a/apps/example-app-karma/src/test.ts b/apps/example-app-karma/src/test.ts index 867baf94..0a45adb5 100644 --- a/apps/example-app-karma/src/test.ts +++ b/apps/example-app-karma/src/test.ts @@ -11,7 +11,7 @@ beforeAll(() => { declare const require: any; // First, initialize the Angular testing environment. -getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()); +getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {}); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); // And load the modules. diff --git a/apps/example-app-karma/tsconfig.app.json b/apps/example-app-karma/tsconfig.app.json index 629fd434..4de7101b 100644 --- a/apps/example-app-karma/tsconfig.app.json +++ b/apps/example-app-karma/tsconfig.app.json @@ -5,5 +5,7 @@ "types": [], "allowJs": true }, - "files": ["src/main.ts", "src/polyfills.ts"] + "files": ["src/main.ts", "src/polyfills.ts"], + "include": ["src/**/*.d.ts"], + "exclude": ["**/*.test.ts", "**/*.spec.ts"] } diff --git a/apps/example-app-karma/tsconfig.json b/apps/example-app-karma/tsconfig.json index e1d5ba47..0cfe7c56 100644 --- a/apps/example-app-karma/tsconfig.json +++ b/apps/example-app-karma/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "files": [], "include": [], "compilerOptions": {}, diff --git a/apps/example-app/project.json b/apps/example-app/project.json new file mode 100644 index 00000000..ebab97cb --- /dev/null +++ b/apps/example-app/project.json @@ -0,0 +1,82 @@ +{ + "projectType": "application", + "root": "apps/example-app", + "sourceRoot": "apps/example-app/src", + "prefix": "app", + "generators": {}, + "targets": { + "build": { + "executor": "@angular-devkit/build-angular:browser", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/apps/example-app", + "index": "apps/example-app/src/index.html", + "main": "apps/example-app/src/main.ts", + "polyfills": "apps/example-app/src/polyfills.ts", + "tsConfig": "apps/example-app/tsconfig.app.json", + "assets": ["apps/example-app/src/favicon.ico", "apps/example-app/src/assets"], + "styles": ["apps/example-app/src/styles.css"], + "scripts": [] + }, + "configurations": { + "production": { + "budgets": [ + { + "type": "anyComponentStyle", + "maximumWarning": "6kb" + } + ], + "fileReplacements": [ + { + "replace": "apps/example-app/src/environments/environment.ts", + "with": "apps/example-app/src/environments/environment.prod.ts" + } + ], + "outputHashing": "all" + }, + "development": { + "buildOptimizer": false, + "optimization": false, + "vendorChunk": true, + "extractLicenses": false, + "sourceMap": true, + "namedChunks": true + } + }, + "defaultConfiguration": "production" + }, + "serve": { + "executor": "@angular-devkit/build-angular:dev-server", + "configurations": { + "production": { + "browserTarget": "example-app:build:production" + }, + "development": { + "browserTarget": "example-app:build:development" + } + }, + "defaultConfiguration": "development" + }, + "extract-i18n": { + "executor": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "example-app:build" + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": ["apps/example-app/**/*.ts", "apps/example-app/**/*.html", "apps/example-app/src/**/*.html"] + }, + "outputs": ["{options.outputFile}"] + }, + "test": { + "executor": "@nrwl/jest:jest", + "options": { + "jestConfig": "apps/example-app/jest.config.js" + }, + "outputs": ["coverage/"] + } + }, + "tags": [] +} diff --git a/apps/example-app/src/app/examples/03-forms.ts b/apps/example-app/src/app/examples/03-forms.ts index 03fa74f3..bc035a14 100644 --- a/apps/example-app/src/app/examples/03-forms.ts +++ b/apps/example-app/src/app/examples/03-forms.ts @@ -57,9 +57,12 @@ export class FormsComponent { return `${formKey} must be greater than ${error.min}`; case 'max': return `${formKey} must be lesser than ${error.max}`; + default: + return `${formKey} is invalid`; } }); } + return []; }) .reduce((errors, value) => errors.concat(value), []) .filter(Boolean); diff --git a/apps/example-app/src/app/examples/04-forms-with-material.ts b/apps/example-app/src/app/examples/04-forms-with-material.ts index e9a026ce..2718e389 100644 --- a/apps/example-app/src/app/examples/04-forms-with-material.ts +++ b/apps/example-app/src/app/examples/04-forms-with-material.ts @@ -79,9 +79,12 @@ export class MaterialFormsComponent { return `${formKey} must be greater than ${error.min}`; case 'max': return `${formKey} must be lesser than ${error.max}`; + default: + return `${formKey} is invalid`; } }); } + return []; }) .reduce((errors, value) => errors.concat(value), []) .filter(Boolean); diff --git a/apps/example-app/src/polyfills.ts b/apps/example-app/src/polyfills.ts index bb20fec0..f84fd8a6 100644 --- a/apps/example-app/src/polyfills.ts +++ b/apps/example-app/src/polyfills.ts @@ -34,22 +34,12 @@ // import 'core-js/es6/weak-map'; // import 'core-js/es6/set'; -/** IE10 and IE11 requires the following for NgClass support on SVG elements */ -// import 'classlist.js'; // Run `npm install --save classlist.js`. - /** IE10 and IE11 requires the following for the Reflect API. */ // import 'core-js/es6/reflect'; /** Evergreen browsers require these. **/ // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. -/** - * Web Animations `@angular/platform-browser/animations` - * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. - * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). - **/ -// import 'web-animations-js'; // Run `npm install --save web-animations-js`. - /** * By default, zone.js will patch all possible macroTask and DomEvents * user can disable parts of macroTask/DomEvents patch by setting following flags diff --git a/apps/example-app/tsconfig.app.json b/apps/example-app/tsconfig.app.json index 629fd434..4de7101b 100644 --- a/apps/example-app/tsconfig.app.json +++ b/apps/example-app/tsconfig.app.json @@ -5,5 +5,7 @@ "types": [], "allowJs": true }, - "files": ["src/main.ts", "src/polyfills.ts"] + "files": ["src/main.ts", "src/polyfills.ts"], + "include": ["src/**/*.d.ts"], + "exclude": ["**/*.test.ts", "**/*.spec.ts"] } diff --git a/apps/example-app/tsconfig.json b/apps/example-app/tsconfig.json index de50e310..523f7fc7 100644 --- a/apps/example-app/tsconfig.json +++ b/apps/example-app/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "files": [], "include": [], "compilerOptions": {}, diff --git a/apps/example-app/tsconfig.spec.json b/apps/example-app/tsconfig.spec.json index afe056ed..d8a4c20f 100644 --- a/apps/example-app/tsconfig.spec.json +++ b/apps/example-app/tsconfig.spec.json @@ -6,5 +6,5 @@ "types": ["jest", "node", "@testing-library/jest-dom"] }, "files": ["src/test-setup.ts"], - "include": ["**/*.spec.ts", "**/*.d.ts"] + "include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts"] } diff --git a/decorate-angular-cli.js b/decorate-angular-cli.js new file mode 100644 index 00000000..bc81a837 --- /dev/null +++ b/decorate-angular-cli.js @@ -0,0 +1,69 @@ +/** + * This file decorates the Angular CLI with the Nx CLI to enable features such as computation caching + * and faster execution of tasks. + * + * It does this by: + * + * - Patching the Angular CLI to warn you in case you accidentally use the undecorated ng command. + * - Symlinking the ng to nx command, so all commands run through the Nx CLI + * - Updating the package.json postinstall script to give you control over this script + * + * The Nx CLI decorates the Angular CLI, so the Nx CLI is fully compatible with it. + * Every command you run should work the same when using the Nx CLI, except faster. + * + * Because of symlinking you can still type `ng build/test/lint` in the terminal. The ng command, in this case, + * will point to nx, which will perform optimizations before invoking ng. So the Angular CLI is always invoked. + * The Nx CLI simply does some optimizations before invoking the Angular CLI. + * + * To opt out of this patch: + * - Replace occurrences of nx with ng in your package.json + * - Remove the script from your postinstall script in your package.json + * - Delete and reinstall your node_modules + */ + +const fs = require('fs'); +const os = require('os'); +const cp = require('child_process'); +const isWindows = os.platform() === 'win32'; +let output; +try { + output = require('@nrwl/workspace').output; +} catch (e) { + console.warn('Angular CLI could not be decorated to enable computation caching. Please ensure @nrwl/workspace is installed.'); + process.exit(0); +} + +/** + * Symlink of ng to nx, so you can keep using `ng build/test/lint` and still + * invoke the Nx CLI and get the benefits of computation caching. + */ +function symlinkNgCLItoNxCLI() { + try { + const ngPath = './node_modules/.bin/ng'; + const nxPath = './node_modules/.bin/nx'; + if (isWindows) { + /** + * This is the most reliable way to create symlink-like behavior on Windows. + * Such that it works in all shells and works with npx. + */ + ['', '.cmd', '.ps1'].forEach(ext => { + if (fs.existsSync(nxPath + ext)) fs.writeFileSync(ngPath + ext, fs.readFileSync(nxPath + ext)); + }); + } else { + // If unix-based, symlink + cp.execSync(`ln -sf ./nx ${ngPath}`); + } + } + catch(e) { + output.error({ title: 'Unable to create a symlink from the Angular CLI to the Nx CLI:' + e.message }); + throw e; + } +} + +try { + symlinkNgCLItoNxCLI(); + require('@nrwl/cli/lib/decorate-cli').decorateCli(); + output.log({ title: 'Angular CLI has been decorated to enable computation caching.' }); +} catch(e) { + output.error({ title: 'Decoration of the Angular CLI did not complete successfully' }); +} diff --git a/jest.preset.js b/jest.preset.js index 3f434cfc..c9b13e14 100644 --- a/jest.preset.js +++ b/jest.preset.js @@ -3,8 +3,9 @@ module.exports = { ...nxPreset, testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'], transform: { - '^.+\\.(ts|js|html)$': 'ts-jest', + '^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular', }, + transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], resolver: '@nrwl/jest/plugins/resolver', moduleFileExtensions: ['ts', 'js', 'html'], globals: { @@ -13,4 +14,9 @@ module.exports = { stringifyContentPathRegex: '\\.(html|svg)$', }, }, + snapshotSerializers: [ + 'jest-preset-angular/build/serializers/no-ng-attributes', + 'jest-preset-angular/build/serializers/ng-snapshot', + 'jest-preset-angular/build/serializers/html-comment', + ], }; diff --git a/nx.json b/nx.json index c9020cab..d8e87c08 100644 --- a/nx.json +++ b/nx.json @@ -1,18 +1,27 @@ { + "npmScope": "testing-library", + "affected": { + "defaultBase": "main" + }, + "workspaceLayout": { + "appsDir": "apps", + "libsDir": "projects" + }, + "cli": { + "analytics": false, + "cache": { + "enabled": true, + "path": "./.cache/angular", + "environment": "all" + } + }, "implicitDependencies": { - "angular.json": "*", "package.json": { "dependencies": "*", "devDependencies": "*" }, - "tsconfig.base.json": "*", - ".eslintrc.json": "*", - "nx.json": "*" - }, - "affected": { - "defaultBase": "main" + ".eslintrc.json": "*" }, - "npmScope": "testing-library", "tasksRunnerOptions": { "default": { "runner": "@nrwl/nx-cloud", @@ -20,22 +29,56 @@ "accessToken": "M2Q4YjlkNjMtMzY1NC00ZjkwLTk1ZjgtZjg5Y2VkMzFjM2FifHJlYWQtd3JpdGU=", "cacheableOperations": ["build", "test", "lint", "e2e"], "canTrackAnalytics": false, - "showUsageWarnings": true + "showUsageWarnings": true, + "parallel": 3 } } }, - "projects": { - "example-app": { - "tags": [] + "targetDependencies": { + "build": [ + { + "target": "build", + "projects": "dependencies" + } + ] + }, + "generators": { + "@nrlw/workspace:library": { + "linter": "eslint", + "unitTestRunner": "jest", + "strict": true, + "standaloneConfig": true, + "buildable": true + }, + "@nrwl/angular:application": { + "style": "scss", + "linter": "eslint", + "unitTestRunner": "jest", + "e2eTestRunner": "cypress", + "strict": true, + "standaloneConfig": true, + "tags": ["type:app"] }, - "example-app-karma": { - "tags": [] + "@nrwl/angular:library": { + "style": "scss", + "linter": "eslint", + "unitTestRunner": "jest", + "strict": true, + "standaloneConfig": true, + "publishable": true }, - "jest-utils": { - "tags": [] + "@nrwl/angular:component": { + "style": "scss", + "displayBlock": true, + "changeDetection": "OnPush" }, - "testing-library": { - "tags": [] + "@schematics/angular": { + "component": { + "style": "scss", + "displayBlock": true, + "changeDetection": "OnPush" + } } - } + }, + "defaultProject": "example-app" } diff --git a/package.json b/package.json index bf69d070..3c7c74ec 100644 --- a/package.json +++ b/package.json @@ -2,16 +2,16 @@ "name": "@testing-library/angular-app", "version": "0.0.0-semantically-released", "scripts": { - "ng": "ng", + "ng": "nx", "nx": "nx", - "postinstall": "ngcc", - "start": "ng serve", + "postinstall": "node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main", + "start": "nx serve", "prebuild": "rimraf dist", "build": "nx run-many --target=build --projects=testing-library,jest-utils", "build:schematics": "tsc -p ./projects/testing-library/tsconfig.schematics.json", "test": "nx run-many --target=test --all", - "lint": "nx workspace-lint && ng lint", - "e2e": "ng e2e", + "lint": "nx workspace-lint && nx lint", + "e2e": "nx e2e", "affected:apps": "nx affected:apps", "affected:libs": "nx affected:libs", "affected:build": "nx affected:build", @@ -28,72 +28,75 @@ "prepare": "husky install" }, "dependencies": { - "@angular/animations": "12.2.0", - "@angular/cdk": "12.2.0", - "@angular/common": "12.2.0", - "@angular/compiler": "12.2.0", - "@angular/core": "12.2.0", - "@angular/forms": "12.2.0", - "@angular/material": "12.2.0", - "@angular/platform-browser": "12.2.0", - "@angular/platform-browser-dynamic": "12.2.0", - "@angular/router": "12.2.0", - "@ngrx/store": "12.4.0", - "@nrwl/angular": "12.9.0", - "@nrwl/nx-cloud": "12.3.12", - "@testing-library/dom": "^8.0.0", - "@testing-library/user-event": "^13.1.9", - "core-js": "^3.6.5", - "rxjs": "^6.5.5", - "tslib": "^2.0.0", - "zone.js": "0.11.4" + "@angular/animations": "13.0.2", + "@angular/cdk": "13.0.2", + "@angular/common": "13.0.2", + "@angular/compiler": "13.0.2", + "@angular/core": "13.0.2", + "@angular/forms": "13.0.2", + "@angular/material": "13.0.2", + "@angular/platform-browser": "13.0.2", + "@angular/platform-browser-dynamic": "13.0.2", + "@angular/router": "13.0.2", + "@ngrx/store": "13.0.1", + "@nrwl/angular": "13.2.2", + "@nrwl/nx-cloud": "12.5.4", + "@testing-library/dom": "^8.11.1", + "@testing-library/user-event": "^13.5.0", + "rxjs": "^7.4.0", + "tslib": "~2.3.1", + "zone.js": "~0.11.4" }, "devDependencies": { - "@angular-devkit/build-angular": "12.2.7", - "@angular-eslint/eslint-plugin": "12.3.1", - "@angular-eslint/eslint-plugin-template": "12.3.1", - "@angular-eslint/template-parser": "12.3.1", - "@angular/cli": "12.2.7", - "@angular/compiler-cli": "12.2.0", - "@angular/language-service": "12.2.0", - "@nrwl/cli": "12.9.0", - "@nrwl/eslint-plugin-nx": "12.9.0", - "@nrwl/jest": "12.9.0", - "@nrwl/linter": "12.9.0", - "@nrwl/node": "12.9.0", - "@nrwl/nx-plugin": "12.9.0", - "@nrwl/workspace": "12.9.0", + "@angular-devkit/build-angular": "13.0.3", + "@angular-eslint/eslint-plugin": "12.6.1", + "@angular-eslint/eslint-plugin-template": "12.6.1", + "@angular-eslint/template-parser": "12.6.1", + "@angular/cli": "13.0.3", + "@angular/compiler-cli": "13.0.2", + "@angular/language-service": "13.0.2", + "@nrwl/cli": "13.2.2", + "@nrwl/eslint-plugin-nx": "13.2.2", + "@nrwl/jest": "13.2.2", + "@nrwl/linter": "13.2.2", + "@nrwl/node": "13.2.2", + "@nrwl/nx-plugin": "13.2.2", + "@nrwl/workspace": "13.2.2", "@testing-library/jasmine-dom": "^1.2.0", - "@testing-library/jest-dom": "^5.11.10", - "@types/jasmine": "^3.5.0", - "@types/jest": "^27.0.2", + "@testing-library/jest-dom": "^5.15.1", + "@types/jasmine": "^3.10.2", + "@types/jest": "27.0.3", "@types/node": "14.14.37", - "@typescript-eslint/eslint-plugin": "4.28.5", - "@typescript-eslint/parser": "4.28.5", + "@typescript-eslint/eslint-plugin": "4.33.0", + "@typescript-eslint/parser": "4.33.0", "cpy-cli": "^3.1.1", - "eslint": "^7.25.0", + "eslint": "7.32.0", "eslint-config-prettier": "8.3.0", "eslint-plugin-import": "2.23.4", "eslint-plugin-jasmine": "^4.1.2", "eslint-plugin-jest": "24.3.6", "eslint-plugin-jest-dom": "3.9.0", "eslint-plugin-testing-library": "4.9.0", - "husky": "^6.0.0", - "jasmine-core": "^3.7.0", - "jasmine-spec-reporter": "^5.0.0", - "jest": "^27.0.6", - "jest-preset-angular": "9.0.7", - "karma": "^6.3.4", + "husky": "^7.0.0", + "jasmine-core": "^3.10.1", + "jasmine-spec-reporter": "^7.0.0", + "jest": "27.3.1", + "jest-preset-angular": "11.0.1", + "karma": "^6.3.9", "karma-chrome-launcher": "^3.1.0", - "karma-jasmine": "^4.0.0", - "karma-jasmine-html-reporter": "^1.5.0", - "lint-staged": "^10.2.11", - "ng-packagr": "12.2.2", - "prettier": "^2.3.0", + "karma-jasmine": "^4.0.1", + "karma-jasmine-html-reporter": "^1.7.0", + "lint-staged": "^12.1.2", + "ng-packagr": "~13.0.7", + "postcss": "^8.3.11", + "postcss-import": "^14.0.2", + "postcss-preset-env": "^7.0.1", + "postcss-url": "^10.1.3", + "prettier": "^2.4.1", "rimraf": "^3.0.2", - "semantic-release": "^17.1.1", - "ts-jest": "^27.0.3", - "ts-node": "9.1.1", - "typescript": "4.3.5" + "semantic-release": "^18.0.0", + "ts-jest": "27.0.7", + "ts-node": "~10.4.0", + "typescript": "4.4.4" } } diff --git a/projects/jest-utils/package.json b/projects/jest-utils/package.json index 09dc20bf..4462dc31 100644 --- a/projects/jest-utils/package.json +++ b/projects/jest-utils/package.json @@ -22,7 +22,7 @@ }, "homepage": "https://github.com/testing-library/angular-testing-library#readme", "peerDependencies": { - "jest": ">=23.4.0" + "jest": ">=27.0.0" }, "publishConfig": { "access": "public" diff --git a/projects/jest-utils/project.json b/projects/jest-utils/project.json new file mode 100644 index 00000000..8c4976f6 --- /dev/null +++ b/projects/jest-utils/project.json @@ -0,0 +1,54 @@ +{ + "projectType": "library", + "root": "projects/jest-utils", + "sourceRoot": "projects/jest-utils/src", + "prefix": "lib", + "targets": { + "build-package": { + "executor": "@nrwl/angular:package", + "outputs": ["dist/@testing-library/angular/jest-utils"], + "options": { + "project": "projects/jest-utils/ng-package.json" + }, + "configurations": { + "production": { + "tsConfig": "projects/jest-utils/tsconfig.lib.prod.json" + }, + "development": { + "tsConfig": "projects/jest-utils/tsconfig.lib.json" + } + }, + "defaultConfiguration": "production" + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": [ + "projects/jest-utils/**/*.ts", + "projects/jest-utils/**/*.html", + "projects/jest-utils/src/**/*.html" + ] + }, + "outputs": ["{options.outputFile}"] + }, + "build": { + "executor": "@nrwl/workspace:run-commands", + "options": { + "parallel": false, + "commands": [ + { + "command": "nx run jest-utils:build-package" + } + ] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "options": { + "jestConfig": "projects/jest-utils/jest.config.js" + }, + "outputs": ["coverage/projects/jest-utils"] + } + }, + "tags": [] +} diff --git a/projects/jest-utils/src/lib/create-mock.ts b/projects/jest-utils/src/lib/create-mock.ts index 2796d972..73cbf406 100644 --- a/projects/jest-utils/src/lib/create-mock.ts +++ b/projects/jest-utils/src/lib/create-mock.ts @@ -16,7 +16,7 @@ export function createMock(type: Type): Mock { } const descriptor = Object.getOwnPropertyDescriptor(proto, prop); - if (typeof descriptor.value === 'function') { + if (typeof descriptor?.value === 'function') { mock[prop] = jest.fn(); } } diff --git a/projects/jest-utils/tests/create-mock.spec.ts b/projects/jest-utils/tests/create-mock.spec.ts index ded7ab1c..2393fe30 100644 --- a/projects/jest-utils/tests/create-mock.spec.ts +++ b/projects/jest-utils/tests/create-mock.spec.ts @@ -45,10 +45,12 @@ test('provides a mock service', async () => { test('provides a mock service with values', async () => { await render(FixtureComponent, { - providers: [provideMockWithValues(FixtureService, { - bar: 'value', - concat: jest.fn(() => 'a concatenated value') - })], + providers: [ + provideMockWithValues(FixtureService, { + bar: 'value', + concat: jest.fn(() => 'a concatenated value'), + }), + ], }); const service = TestBed.inject(FixtureService); diff --git a/projects/jest-utils/tsconfig.json b/projects/jest-utils/tsconfig.json new file mode 100644 index 00000000..24663f6f --- /dev/null +++ b/projects/jest-utils/tsconfig.json @@ -0,0 +1,24 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.lib.prod.json" + }, + { + "path": "./tsconfig.spec.json" + } + ], + "compilerOptions": {}, + "angularCompilerOptions": { + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true, + "flatModuleId": "AUTOGENERATED", + "flatModuleOutFile": "AUTOGENERATED" + } +} diff --git a/projects/jest-utils/tsconfig.lib.json b/projects/jest-utils/tsconfig.lib.json index 7a6179a2..22fef254 100644 --- a/projects/jest-utils/tsconfig.lib.json +++ b/projects/jest-utils/tsconfig.lib.json @@ -1,29 +1,11 @@ { - "extends": "../../tsconfig.json", + "extends": "./tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/lib", - "target": "es2015", - "declarationMap": false, - "module": "es2015", - "moduleResolution": "node", "declaration": true, - "sourceMap": true, + "declarationMap": true, "inlineSources": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "importHelpers": true, - "allowSyntheticDefaultImports": true, - "types": ["jest"], - "lib": ["dom", "es2018"] + "types": ["jest"] }, - "angularCompilerOptions": { - "enableIvy": false, - "skipTemplateCodegen": true, - "strictMetadataEmit": true, - "fullTemplateTypeCheck": true, - "strictInjectionParameters": true, - "flatModuleId": "AUTOGENERATED", - "flatModuleOutFile": "AUTOGENERATED" - }, - "exclude": ["src/test.ts", "**/*.spec.ts"] + "exclude": ["src/test.ts", "**/*.spec.ts", "**/*.test.ts"] } diff --git a/projects/jest-utils/tsconfig.lib.prod.json b/projects/jest-utils/tsconfig.lib.prod.json new file mode 100644 index 00000000..2a2faa88 --- /dev/null +++ b/projects/jest-utils/tsconfig.lib.prod.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.lib.json", + "compilerOptions": { + "declarationMap": false + }, + "angularCompilerOptions": { + "compilationMode": "partial" + } +} diff --git a/projects/jest-utils/tsconfig.spec.json b/projects/jest-utils/tsconfig.spec.json index 091c5cf3..73461f35 100644 --- a/projects/jest-utils/tsconfig.spec.json +++ b/projects/jest-utils/tsconfig.spec.json @@ -1,9 +1,9 @@ { - "extends": "../../tsconfig.json", + "extends": "./tsconfig.json", "compilerOptions": { "module": "commonjs", "types": ["node", "jest", "@testing-library/jest-dom"] }, "files": ["test-setup.ts"], - "include": ["**/*.spec.ts", "**/*.d.ts"] + "include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts"] } diff --git a/projects/testing-library/package.json b/projects/testing-library/package.json index f1922ae6..e41389cf 100644 --- a/projects/testing-library/package.json +++ b/projects/testing-library/package.json @@ -29,11 +29,11 @@ "migrations": "./schematics/migrations/migration.json" }, "peerDependencies": { - "@angular/common": ">= 10.0.0", - "@angular/platform-browser": ">= 10.0.0", - "@angular/animations": ">= 10.0.0", - "@angular/router": ">= 10.0.0", - "@angular/core": ">= 10.0.0" + "@angular/common": ">= 13.0.0", + "@angular/platform-browser": ">= 13.0.0", + "@angular/animations": ">= 13.0.0", + "@angular/router": ">= 13.0.0", + "@angular/core": ">= 13.0.0" }, "dependencies": { "@testing-library/dom": "^8.0.0", diff --git a/projects/testing-library/project.json b/projects/testing-library/project.json new file mode 100644 index 00000000..fe6d0834 --- /dev/null +++ b/projects/testing-library/project.json @@ -0,0 +1,60 @@ +{ + "projectType": "library", + "root": "projects/testing-library", + "sourceRoot": "projects/testing-library/src", + "prefix": "lib", + "targets": { + "build-package": { + "executor": "@nrwl/angular:package", + "outputs": ["dist/@testing-library/angular"], + "options": { + "project": "projects/testing-library/ng-package.json" + }, + "configurations": { + "production": { + "tsConfig": "projects/testing-library/tsconfig.lib.prod.json" + }, + "development": { + "tsConfig": "projects/testing-library/tsconfig.lib.json" + } + }, + "defaultConfiguration": "production" + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": [ + "projects/testing-library/**/*.ts", + "projects/testing-library/**/*.html", + "projects/testing-library/src/**/*.html" + ] + }, + "outputs": ["{options.outputFile}"] + }, + "build": { + "executor": "@nrwl/workspace:run-commands", + "options": { + "parallel": false, + "commands": [ + { + "command": "nx run testing-library:build-package" + }, + { + "command": "npm run build:schematics" + }, + { + "command": "cpy ./README.md ./dist/@testing-library/angular" + } + ] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "options": { + "jestConfig": "projects/testing-library/jest.config.js" + }, + "outputs": ["coverage/projects/testing-library"] + } + }, + "tags": [] +} diff --git a/projects/testing-library/tests/render.spec.ts b/projects/testing-library/tests/render.spec.ts index 678da79c..8312bd4a 100644 --- a/projects/testing-library/tests/render.spec.ts +++ b/projects/testing-library/tests/render.spec.ts @@ -10,7 +10,7 @@ import { } from '@angular/core'; import { NoopAnimationsModule, BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { TestBed } from '@angular/core/testing'; -import { render, fireEvent, screen } from '../src/public_api'; +import { render, fireEvent } from '../src/public_api'; @Component({ selector: 'atl-fixture', diff --git a/projects/testing-library/tsconfig.json b/projects/testing-library/tsconfig.json new file mode 100644 index 00000000..24663f6f --- /dev/null +++ b/projects/testing-library/tsconfig.json @@ -0,0 +1,24 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.lib.prod.json" + }, + { + "path": "./tsconfig.spec.json" + } + ], + "compilerOptions": {}, + "angularCompilerOptions": { + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true, + "flatModuleId": "AUTOGENERATED", + "flatModuleOutFile": "AUTOGENERATED" + } +} diff --git a/projects/testing-library/tsconfig.lib.json b/projects/testing-library/tsconfig.lib.json index 8506c888..f7b1b9ca 100644 --- a/projects/testing-library/tsconfig.lib.json +++ b/projects/testing-library/tsconfig.lib.json @@ -1,28 +1,11 @@ { - "extends": "../../tsconfig.json", + "extends": "./tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/lib", - "declarationMap": false, - "target": "es2015", - "module": "ES2015", - "moduleResolution": "node", "declaration": true, - "sourceMap": true, + "declarationMap": true, "inlineSources": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "importHelpers": false, - "types": ["node", "jest"], - "lib": ["dom", "es2018"] + "types": ["node", "jest"] }, - "angularCompilerOptions": { - "enableIvy": false, - "skipTemplateCodegen": true, - "strictMetadataEmit": true, - "fullTemplateTypeCheck": true, - "strictInjectionParameters": true, - "flatModuleId": "AUTOGENERATED", - "flatModuleOutFile": "AUTOGENERATED" - }, - "exclude": ["src/test.ts", "**/*.spec.ts"] + "exclude": ["src/test.ts", "**/*.spec.ts", "**/*.test.ts"] } diff --git a/projects/testing-library/tsconfig.lib.prod.json b/projects/testing-library/tsconfig.lib.prod.json new file mode 100644 index 00000000..2a2faa88 --- /dev/null +++ b/projects/testing-library/tsconfig.lib.prod.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.lib.json", + "compilerOptions": { + "declarationMap": false + }, + "angularCompilerOptions": { + "compilationMode": "partial" + } +} diff --git a/projects/testing-library/tsconfig.schematics.json b/projects/testing-library/tsconfig.schematics.json index 91de9574..0573a52a 100644 --- a/projects/testing-library/tsconfig.schematics.json +++ b/projects/testing-library/tsconfig.schematics.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "strict": true, "target": "es6", diff --git a/projects/testing-library/tsconfig.spec.json b/projects/testing-library/tsconfig.spec.json index 091c5cf3..73461f35 100644 --- a/projects/testing-library/tsconfig.spec.json +++ b/projects/testing-library/tsconfig.spec.json @@ -1,9 +1,9 @@ { - "extends": "../../tsconfig.json", + "extends": "./tsconfig.json", "compilerOptions": { "module": "commonjs", "types": ["node", "jest", "@testing-library/jest-dom"] }, "files": ["test-setup.ts"], - "include": ["**/*.spec.ts", "**/*.d.ts"] + "include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts"] } diff --git a/projects/vscode-atl-render/.vscode/launch.json b/projects/vscode-atl-render/.vscode/launch.json index 0e191b59..4058e694 100644 --- a/projects/vscode-atl-render/.vscode/launch.json +++ b/projects/vscode-atl-render/.vscode/launch.json @@ -3,15 +3,13 @@ // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 { - "version": "0.2.0", - "configurations": [ - { - "name": "Extension", - "type": "extensionHost", - "request": "launch", - "args": [ - "--extensionDevelopmentPath=${workspaceFolder}" - ] - } - ] -} \ No newline at end of file + "version": "0.2.0", + "configurations": [ + { + "name": "Extension", + "type": "extensionHost", + "request": "launch", + "args": ["--extensionDevelopmentPath=${workspaceFolder}"] + } + ] +} diff --git a/tsconfig.json b/tsconfig.base.json similarity index 73% rename from tsconfig.json rename to tsconfig.base.json index 69eb7ed5..0ad01d03 100644 --- a/tsconfig.json +++ b/tsconfig.base.json @@ -2,20 +2,24 @@ "compileOnSave": false, "compilerOptions": { "baseUrl": "./", + "declaration": false, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, "importHelpers": true, + "lib": ["es2018", "dom"], "module": "esnext", + "moduleResolution": "node", "outDir": "./dist/out-tsc", "sourceMap": true, - "declaration": false, - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, "target": "es2015", "typeRoots": ["node_modules/@types"], - "lib": ["es2017", "dom"], + "forceConsistentCasingInFileNames": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, "paths": { "@testing-library/angular": ["projects/testing-library"], "@testing-library/angular/jest-utils": ["projects/jest-utils"] } - } + }, + "exclude": ["node_modules", "tmp"] } diff --git a/workspace.json b/workspace.json new file mode 100644 index 00000000..dfd6bcf1 --- /dev/null +++ b/workspace.json @@ -0,0 +1,9 @@ +{ + "version": 2, + "projects": { + "example-app": "apps/example-app", + "example-app-karma": "apps/example-app-karma", + "jest-utils": "projects/jest-utils", + "testing-library": "projects/testing-library" + } +}