diff --git a/.husky/_/husky.sh b/.husky/_/husky.sh
index ca2720e0..6809ccca 100644
--- a/.husky/_/husky.sh
+++ b/.husky/_/husky.sh
@@ -1,7 +1,9 @@
#!/bin/sh
if [ -z "$husky_skip_init" ]; then
debug () {
- [ "$HUSKY_DEBUG" = "1" ] && echo "husky (debug) - $1"
+ if [ "$HUSKY_DEBUG" = "1" ]; then
+ echo "husky (debug) - $1"
+ fi
}
readonly hook_name="$(basename "$0")"
@@ -23,8 +25,7 @@ if [ -z "$husky_skip_init" ]; then
if [ $exitCode != 0 ]; then
echo "husky - $hook_name hook exited with code $exitCode (error)"
- exit $exitCode
fi
- exit 0
+ exit $exitCode
fi
diff --git a/angular.json b/angular.json
index 50afdec9..dfd6bcf1 100644
--- a/angular.json
+++ b/angular.json
@@ -1,296 +1,9 @@
{
- "version": 1,
- "cli": {
- "analytics": false
- },
- "defaultProject": "example-app",
+ "version": 2,
"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"]
- }
- }
- }
+ "example-app": "apps/example-app",
+ "example-app-karma": "apps/example-app-karma",
+ "jest-utils": "projects/jest-utils",
+ "testing-library": "projects/testing-library"
}
}
diff --git a/apps/example-app/src/app/examples/03-forms.spec.ts b/apps/example-app/src/app/examples/03-forms.spec.ts
index 6be38a45..2a53a5f0 100644
--- a/apps/example-app/src/app/examples/03-forms.spec.ts
+++ b/apps/example-app/src/app/examples/03-forms.spec.ts
@@ -23,7 +23,7 @@ test('is possible to fill in a form and verify error messages (with the help of
userEvent.selectOptions(colorControl, 'G');
expect(screen.queryByText('name is required')).not.toBeInTheDocument();
- expect(screen.queryByText('score must be lesser than 10')).toBeInTheDocument();
+ expect(screen.getByText('score must be lesser than 10')).toBeInTheDocument();
expect(screen.queryByText('color is required')).not.toBeInTheDocument();
expect(scoreControl).toBeInvalid();
diff --git a/apps/example-app/src/app/examples/04-forms-with-material.spec.ts b/apps/example-app/src/app/examples/04-forms-with-material.spec.ts
index 06f14ea8..6d7e1e18 100644
--- a/apps/example-app/src/app/examples/04-forms-with-material.spec.ts
+++ b/apps/example-app/src/app/examples/04-forms-with-material.spec.ts
@@ -4,7 +4,6 @@ import userEvent from '@testing-library/user-event';
import { MaterialModule } from '../material.module';
import { MaterialFormsComponent } from './04-forms-with-material';
-
test('is possible to fill in a form and verify error messages (with the help of jest-dom https://testing-library.com/docs/ecosystem-jest-dom)', async () => {
const { fixture } = await render(MaterialFormsComponent, {
imports: [MaterialModule],
@@ -26,7 +25,7 @@ test('is possible to fill in a form and verify error messages (with the help of
userEvent.click(screen.getByText(/green/i));
expect(screen.queryByText('name is required')).not.toBeInTheDocument();
- expect(screen.queryByText('score must be lesser than 10')).toBeInTheDocument();
+ expect(screen.getByText('score must be lesser than 10')).toBeInTheDocument();
expect(screen.queryByText('color is required')).not.toBeInTheDocument();
expect(scoreControl).toBeInvalid();
@@ -56,8 +55,8 @@ test('set and show pre-set form values', async () => {
fixture.componentInstance.form.setValue({
name: 'Max',
score: 4,
- color: 'B'
- })
+ color: 'B',
+ });
detectChanges();
const nameControl = screen.getByLabelText(/name/i);
diff --git a/apps/example-app/src/app/examples/08-directive.spec.ts b/apps/example-app/src/app/examples/08-directive.spec.ts
index ea3332b4..efd2a5b9 100644
--- a/apps/example-app/src/app/examples/08-directive.spec.ts
+++ b/apps/example-app/src/app/examples/08-directive.spec.ts
@@ -10,14 +10,14 @@ test('it is possible to test directives', async () => {
const directive = screen.getByTestId('dir');
expect(screen.queryByText('I am visible now...')).not.toBeInTheDocument();
- expect(screen.queryByText('SPOILER')).toBeInTheDocument();
+ expect(screen.getByText('SPOILER')).toBeInTheDocument();
fireEvent.mouseOver(directive);
expect(screen.queryByText('SPOILER')).not.toBeInTheDocument();
- expect(screen.queryByText('I am visible now...')).toBeInTheDocument();
+ expect(screen.getByText('I am visible now...')).toBeInTheDocument();
fireEvent.mouseLeave(directive);
- expect(screen.queryByText('SPOILER')).toBeInTheDocument();
+ expect(screen.getByText('SPOILER')).toBeInTheDocument();
expect(screen.queryByText('I am visible now...')).not.toBeInTheDocument();
});
@@ -34,14 +34,14 @@ test('it is possible to test directives with props', async () => {
});
expect(screen.queryByText(visible)).not.toBeInTheDocument();
- expect(screen.queryByText(hidden)).toBeInTheDocument();
+ expect(screen.getByText(hidden)).toBeInTheDocument();
fireEvent.mouseOver(screen.getByText(hidden));
expect(screen.queryByText(hidden)).not.toBeInTheDocument();
- expect(screen.queryByText(visible)).toBeInTheDocument();
+ expect(screen.getByText(visible)).toBeInTheDocument();
fireEvent.mouseLeave(screen.getByText(visible));
- expect(screen.queryByText(hidden)).toBeInTheDocument();
+ expect(screen.getByText(hidden)).toBeInTheDocument();
expect(screen.queryByText(visible)).not.toBeInTheDocument();
});
@@ -54,13 +54,13 @@ test('it is possible to test directives with props in template', async () => {
});
expect(screen.queryByText(visible)).not.toBeInTheDocument();
- expect(screen.queryByText(hidden)).toBeInTheDocument();
+ expect(screen.getByText(hidden)).toBeInTheDocument();
fireEvent.mouseOver(screen.getByText(hidden));
expect(screen.queryByText(hidden)).not.toBeInTheDocument();
- expect(screen.queryByText(visible)).toBeInTheDocument();
+ expect(screen.getByText(visible)).toBeInTheDocument();
fireEvent.mouseLeave(screen.getByText(visible));
- expect(screen.queryByText(hidden)).toBeInTheDocument();
+ expect(screen.getByText(hidden)).toBeInTheDocument();
expect(screen.queryByText(visible)).not.toBeInTheDocument();
});
diff --git a/apps/example-app/src/app/examples/09-router.spec.ts b/apps/example-app/src/app/examples/09-router.spec.ts
index cb6743fc..16f037fc 100644
--- a/apps/example-app/src/app/examples/09-router.spec.ts
+++ b/apps/example-app/src/app/examples/09-router.spec.ts
@@ -25,19 +25,19 @@ test('it can navigate to routes', async () => {
expect(screen.queryByText(/Detail one/i)).not.toBeInTheDocument();
await navigate(screen.getByRole('link', { name: /load one/i }));
- expect(screen.queryByRole('heading', { name: /Detail one/i })).toBeInTheDocument();
+ expect(screen.getByRole('heading', { name: /Detail one/i })).toBeInTheDocument();
await navigate(screen.getByRole('link', { name: /load three/i }));
expect(screen.queryByRole('heading', { name: /Detail one/i })).not.toBeInTheDocument();
- expect(screen.queryByRole('heading', { name: /Detail three/i })).toBeInTheDocument();
+ expect(screen.getByRole('heading', { name: /Detail three/i })).toBeInTheDocument();
await navigate(screen.getByRole('link', { name: /back to parent/i }));
expect(screen.queryByRole('heading', { name: /Detail three/i })).not.toBeInTheDocument();
await navigate(screen.getByRole('link', { name: /load two/i }));
- expect(screen.queryByRole('heading', { name: /Detail two/i })).toBeInTheDocument();
+ expect(screen.getByRole('heading', { name: /Detail two/i })).toBeInTheDocument();
await navigate(screen.getByRole('link', { name: /hidden x/i }));
- expect(screen.queryByText(/You found the treasure!/i)).toBeInTheDocument();
+ expect(screen.getByText(/You found the treasure!/i)).toBeInTheDocument();
});
test('it can navigate to routes with a base path', async () => {
@@ -64,20 +64,20 @@ test('it can navigate to routes with a base path', async () => {
expect(screen.queryByRole('heading', { name: /Detail one/i })).not.toBeInTheDocument();
await navigate(screen.getByRole('link', { name: /load one/i }), basePath);
- expect(screen.queryByRole('heading', { name: /Detail one/i })).toBeInTheDocument();
+ expect(screen.getByRole('heading', { name: /Detail one/i })).toBeInTheDocument();
await navigate(screen.getByRole('link', { name: /load three/i }), basePath);
expect(screen.queryByRole('heading', { name: /Detail one/i })).not.toBeInTheDocument();
- expect(screen.queryByRole('heading', { name: /Detail three/i })).toBeInTheDocument();
+ expect(screen.getByRole('heading', { name: /Detail three/i })).toBeInTheDocument();
await navigate(screen.getByRole('link', { name: /back to parent/i }));
expect(screen.queryByRole('heading', { name: /Detail three/i })).not.toBeInTheDocument();
// It's possible to just use strings
await navigate('base/detail/two?text=Hello&subtext=World');
- expect(screen.queryByRole('heading', { name: /Detail two/i })).toBeInTheDocument();
+ expect(screen.getByRole('heading', { name: /Detail two/i })).toBeInTheDocument();
expect(screen.getByText(/Hello World/i)).toBeInTheDocument();
await navigate('/hidden-detail', basePath);
- expect(screen.queryByText(/You found the treasure!/i)).toBeInTheDocument();
+ expect(screen.getByText(/You found the treasure!/i)).toBeInTheDocument();
});
diff --git a/apps/example-app/src/app/examples/15-dialog.component.spec.ts b/apps/example-app/src/app/examples/15-dialog.component.spec.ts
index 8a0ccd88..31cf2fba 100644
--- a/apps/example-app/src/app/examples/15-dialog.component.spec.ts
+++ b/apps/example-app/src/app/examples/15-dialog.component.spec.ts
@@ -32,15 +32,17 @@ test('closes the dialog via the backdrop', async () => {
const openDialogButton = await screen.findByRole('button', { name: /open dialog/i });
userEvent.click(openDialogButton);
- await screen.findByRole('dialog');
- await screen.findByRole('heading', { name: /dialog title/i });
+ const dialogControl = await screen.findByRole('dialog');
+ expect(dialogControl).toBeInTheDocument();
+ const dialogTitleControl = await screen.findByRole('heading', { name: /dialog title/i });
+ expect(dialogTitleControl).toBeInTheDocument();
// using fireEvent because of:
// unable to click element as it has or inherits pointer-events set to "none"
// eslint-disable-next-line testing-library/no-node-access, @typescript-eslint/no-non-null-assertion
fireEvent.click(document.querySelector('.cdk-overlay-backdrop')!);
- await waitForElementToBeRemoved(() => screen.getByRole('dialog'));
+ await waitForElementToBeRemoved(() => screen.queryByRole('dialog'));
const dialogTitle = screen.queryByRole('heading', { name: /dialog title/i });
expect(dialogTitle).not.toBeInTheDocument();
@@ -54,13 +56,15 @@ test('opens and closes the dialog with buttons', async () => {
const openDialogButton = await screen.findByRole('button', { name: /open dialog/i });
userEvent.click(openDialogButton);
- await screen.findByRole('dialog');
- await screen.findByRole('heading', { name: /dialog title/i });
+ const dialogControl = await screen.findByRole('dialog');
+ expect(dialogControl).toBeInTheDocument();
+ const dialogTitleControl = await screen.findByRole('heading', { name: /dialog title/i });
+ expect(dialogTitleControl).toBeInTheDocument();
const cancelButton = await screen.findByRole('button', { name: /cancel/i });
userEvent.click(cancelButton);
- await waitForElementToBeRemoved(() => screen.getByRole('dialog'));
+ await waitForElementToBeRemoved(() => screen.queryByRole('dialog'));
const dialogTitle = screen.queryByRole('heading', { name: /dialog title/i });
expect(dialogTitle).not.toBeInTheDocument();
diff --git a/apps/example-app/src/app/issues/issue-106.spec.ts b/apps/example-app/src/app/issues/issue-106.spec.ts
index b1f6cc2c..56097a83 100644
--- a/apps/example-app/src/app/issues/issue-106.spec.ts
+++ b/apps/example-app/src/app/issues/issue-106.spec.ts
@@ -1,6 +1,7 @@
import { Component } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
-import { render, screen, fireEvent, waitFor } from '@testing-library/angular';
+import { render, screen, fireEvent } from '@testing-library/angular';
+import { waitFor } from '@testing-library/dom';
@Component({
template: `
@@ -27,6 +28,9 @@ test('https://github.com/testing-library/angular-testing-library/issues/106', as
// await waitFor(() => expect(hiddenText).not.toBeNull());
// succeeds
+ /// Next line is disabled, because we wish to test the behavior of the library and test the bug/issue #106
+ /// @see https://github.com/testing-library/angular-testing-library/pull/277/files#r779743116
+ // eslint-disable-next-line testing-library/prefer-presence-queries, testing-library/prefer-find-by
await waitFor(() => expect(screen.queryByTestId('getme')).toBeInTheDocument());
});
diff --git a/apps/example-app/src/app/issues/issue-254.spec.ts b/apps/example-app/src/app/issues/issue-254.spec.ts
index 74e90fbb..917f35de 100644
--- a/apps/example-app/src/app/issues/issue-254.spec.ts
+++ b/apps/example-app/src/app/issues/issue-254.spec.ts
@@ -26,10 +26,10 @@ class JobsService {
`,
})
class CareerOportunitiesComponent implements OnInit {
- dedicated?: Division;
- intermodal?: Division;
- noCdl?: Division;
- otr?: Division;
+ dedicated: Division | undefined;
+ intermodal: Division | undefined;
+ noCdl: Division | undefined;
+ otr: Division | undefined;
constructor(private jobsService: JobsService) {}
@@ -73,5 +73,6 @@ test('Render Component', async () => {
},
],
});
- await screen.findAllByRole('listitem');
+ const listItemControl = await screen.findAllByRole('listitem');
+ expect(listItemControl).toHaveLength(3);
});
diff --git a/apps/example-app/tsconfig.app.json b/apps/example-app/tsconfig.app.json
index 4de7101b..a009fad9 100644
--- a/apps/example-app/tsconfig.app.json
+++ b/apps/example-app/tsconfig.app.json
@@ -3,7 +3,8 @@
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": [],
- "allowJs": true
+ "allowJs": true,
+ "target": "ES2017"
},
"files": ["src/main.ts", "src/polyfills.ts"],
"include": ["src/**/*.d.ts"],
diff --git a/package.json b/package.json
index 3c7c74ec..7b514db6 100644
--- a/package.json
+++ b/package.json
@@ -28,75 +28,75 @@
"prepare": "husky install"
},
"dependencies": {
- "@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",
+ "@angular/animations": "13.1.1",
+ "@angular/cdk": "13.1.1",
+ "@angular/common": "13.1.1",
+ "@angular/compiler": "13.1.1",
+ "@angular/core": "13.1.1",
+ "@angular/material": "13.1.1",
+ "@angular/platform-browser": "13.1.1",
+ "@angular/platform-browser-dynamic": "13.1.1",
+ "@angular/router": "13.1.1",
+ "@ngrx/store": "13.0.2",
+ "@nrwl/angular": "13.4.3",
+ "@nrwl/nx-cloud": "13.0.2",
"@testing-library/dom": "^8.11.1",
- "@testing-library/user-event": "^13.5.0",
- "rxjs": "^7.4.0",
+ "rxjs": "^7.5.1",
"tslib": "~2.3.1",
"zone.js": "~0.11.4"
},
"devDependencies": {
- "@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",
+ "@angular-devkit/build-angular": "13.1.2",
+ "@angular-eslint/eslint-plugin": "13.0.1",
+ "@angular-eslint/eslint-plugin-template": "13.0.1",
+ "@angular-eslint/template-parser": "13.0.1",
+ "@angular/cli": "13.1.2",
+ "@angular/compiler-cli": "13.1.1",
+ "@angular/forms": "13.1.1",
+ "@angular/language-service": "13.1.1",
+ "@nrwl/cli": "13.4.3",
+ "@nrwl/eslint-plugin-nx": "13.4.3",
+ "@nrwl/jest": "13.4.3",
+ "@nrwl/linter": "13.4.3",
+ "@nrwl/node": "13.4.3",
+ "@nrwl/nx-plugin": "13.4.3",
+ "@nrwl/workspace": "13.4.3",
"@testing-library/jasmine-dom": "^1.2.0",
"@testing-library/jest-dom": "^5.15.1",
+ "@testing-library/user-event": "^13.5.0",
"@types/jasmine": "^3.10.2",
- "@types/jest": "27.0.3",
+ "@types/jest": "27.4.0",
"@types/node": "14.14.37",
- "@typescript-eslint/eslint-plugin": "4.33.0",
- "@typescript-eslint/parser": "4.33.0",
+ "@typescript-eslint/eslint-plugin": "~5.3.0",
+ "@typescript-eslint/parser": "~5.3.0",
"cpy-cli": "^3.1.1",
- "eslint": "7.32.0",
+ "eslint": "~8.6.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",
+ "eslint-plugin-import": "~2.25.4",
+ "eslint-plugin-jasmine": "~4.1.3",
+ "eslint-plugin-jest": "~25.3.4",
+ "eslint-plugin-jest-dom": "~4.0.1",
+ "eslint-plugin-testing-library": "~5.0.1",
"husky": "^7.0.0",
"jasmine-core": "^3.10.1",
"jasmine-spec-reporter": "^7.0.0",
- "jest": "27.3.1",
+ "jest": "27.4.7",
"jest-preset-angular": "11.0.1",
"karma": "^6.3.9",
"karma-chrome-launcher": "^3.1.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",
+ "lint-staged": "^12.1.6",
+ "ng-packagr": "13.1.2",
+ "postcss": "^8.4.5",
"postcss-import": "^14.0.2",
- "postcss-preset-env": "^7.0.1",
+ "postcss-preset-env": "^7.2.0",
"postcss-url": "^10.1.3",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"semantic-release": "^18.0.0",
- "ts-jest": "27.0.7",
+ "ts-jest": "27.1.2",
"ts-node": "~10.4.0",
- "typescript": "4.4.4"
+ "typescript": "4.5.4"
}
}
diff --git a/projects/jest-utils/tsconfig.json b/projects/jest-utils/tsconfig.json
index fd77caf1..24663f6f 100644
--- a/projects/jest-utils/tsconfig.json
+++ b/projects/jest-utils/tsconfig.json
@@ -6,13 +6,15 @@
{
"path": "./tsconfig.lib.json"
},
+ {
+ "path": "./tsconfig.lib.prod.json"
+ },
{
"path": "./tsconfig.spec.json"
}
],
"compilerOptions": {},
"angularCompilerOptions": {
- "compilationMode": "partial",
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true,
diff --git a/projects/jest-utils/tsconfig.lib.json b/projects/jest-utils/tsconfig.lib.json
index 22fef254..0566ff84 100644
--- a/projects/jest-utils/tsconfig.lib.json
+++ b/projects/jest-utils/tsconfig.lib.json
@@ -1,11 +1,12 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
- "outDir": "../../out-tsc/lib",
+ "outDir": "../../dist/out-tsc",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": ["jest"]
},
- "exclude": ["src/test.ts", "**/*.spec.ts", "**/*.test.ts"]
+ "exclude": ["src/test.ts", "**/*.spec.ts", "**/*.test.ts"],
+ "include": ["**/*.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/testing-library/package.json b/projects/testing-library/package.json
index e41389cf..7d14c654 100644
--- a/projects/testing-library/package.json
+++ b/projects/testing-library/package.json
@@ -31,13 +31,13 @@
"peerDependencies": {
"@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"
+ "@angular/core": ">= 13.0.0",
+ "rxjs": ">= 7.4.0"
},
"dependencies": {
"@testing-library/dom": "^8.0.0",
- "tslib": "^2.0.0"
+ "tslib": "^2.3.1"
},
"publishConfig": {
"access": "public"
diff --git a/projects/testing-library/project.json b/projects/testing-library/project.json
index fe6d0834..1caa86ee 100644
--- a/projects/testing-library/project.json
+++ b/projects/testing-library/project.json
@@ -23,11 +23,7 @@
"lint": {
"executor": "@nrwl/linter:eslint",
"options": {
- "lintFilePatterns": [
- "projects/testing-library/**/*.ts",
- "projects/testing-library/**/*.html",
- "projects/testing-library/src/**/*.html"
- ]
+ "lintFilePatterns": ["projects/testing-library/**/*.ts", "projects/testing-library/**/*.html"]
},
"outputs": ["{options.outputFile}"]
},
diff --git a/projects/testing-library/src/lib/testing-library.ts b/projects/testing-library/src/lib/testing-library.ts
index 1197cf8e..65877ef3 100644
--- a/projects/testing-library/src/lib/testing-library.ts
+++ b/projects/testing-library/src/lib/testing-library.ts
@@ -57,7 +57,7 @@ export async function render(
componentProperties = {},
componentProviders = [],
excludeComponentDeclaration = false,
- routes,
+ routes = [],
removeAngularAttributes = false,
defaultImports = [],
} = { ...globalConfig, ...renderOptions };
diff --git a/projects/testing-library/tsconfig.json b/projects/testing-library/tsconfig.json
index fd77caf1..24663f6f 100644
--- a/projects/testing-library/tsconfig.json
+++ b/projects/testing-library/tsconfig.json
@@ -6,13 +6,15 @@
{
"path": "./tsconfig.lib.json"
},
+ {
+ "path": "./tsconfig.lib.prod.json"
+ },
{
"path": "./tsconfig.spec.json"
}
],
"compilerOptions": {},
"angularCompilerOptions": {
- "compilationMode": "partial",
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true,
diff --git a/projects/testing-library/tsconfig.lib.json b/projects/testing-library/tsconfig.lib.json
index f7b1b9ca..7d77d4c9 100644
--- a/projects/testing-library/tsconfig.lib.json
+++ b/projects/testing-library/tsconfig.lib.json
@@ -1,11 +1,12 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
- "outDir": "../../out-tsc/lib",
+ "outDir": "../../dist/out-tsc",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": ["node", "jest"]
},
- "exclude": ["src/test.ts", "**/*.spec.ts", "**/*.test.ts"]
+ "exclude": ["src/test-setup.ts", "**/*.spec.ts", "**/*.test.ts"],
+ "include": ["**/*.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/tsconfig.base.json b/tsconfig.base.json
index 59f62014..1e0de6e1 100644
--- a/tsconfig.base.json
+++ b/tsconfig.base.json
@@ -14,11 +14,13 @@
"target": "es2015",
"typeRoots": ["node_modules/@types"],
"strict": true,
+ "exactOptionalPropertyTypes": true,
+ "forceConsistentCasingInFileNames": true,
+ "noImplicitOverride": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
- "forceConsistentCasingInFileNames": true,
"paths": {
"@testing-library/angular": ["projects/testing-library"],
"@testing-library/angular/jest-utils": ["projects/jest-utils"]
diff --git a/workspace.json b/workspace.json
deleted file mode 100644
index dfd6bcf1..00000000
--- a/workspace.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "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"
- }
-}