Skip to content

Commit

Permalink
feat: initial release of scoped package (#20)
Browse files Browse the repository at this point in the history
Reference: testing-library/dom-testing-library#260

BREAKING CHANGE:

You must update all imports from '@angular-extensions/testing-library' to '@testing-library/angular'
  • Loading branch information
timdeschryver authored May 31, 2019
1 parent 474253f commit 7f1dce6
Show file tree
Hide file tree
Showing 16 changed files with 58 additions and 60 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div align="center">
<h1>@angular-extensions/testing-library</h1>
<h1>@testing-library/angular</h1>

<a href="https://www.emojione.com/emoji/1f994">
<img
Expand Down Expand Up @@ -80,9 +80,9 @@ your team down.

## This solution

The `@angular-extensions/testing-library` is a very lightweight solution for
The `@testing-library/angular` is a very lightweight solution for
testing Angular components. It provides light utility functions on top of `Angular`
and `dom-testing-library`, in a way that encourages better testing practices. Its
and `@testing-library/dom`, in a way that encourages better testing practices. Its
primary guiding principle is:

> [The more your tests resemble the way your software is used, the more
Expand Down Expand Up @@ -117,7 +117,7 @@ export class CounterComponent {
counter.component.spec.ts

```javascript
import { render } from '@angular-extensions/testing-library';
import { render } from '@testing-library/angular';
import CounterComponent from './counter.component.ts';

describe('Counter', () => {
Expand All @@ -143,7 +143,7 @@ This module is distributed via [npm][npm] which is bundled with [node][node] and
should be installed as one of your project's `devDependencies`:

```bash
npm install @angular-extensions/testing-library --save-dev
npm install @testing-library/angular --save-dev
```

You may also be interested in installing `jest-dom` so you can use
Expand Down Expand Up @@ -232,13 +232,13 @@ Links:
[build]: https://circleci.com/gh/testing-library/angular-testing-library/tree/master
[coverage]: https://codecov.io/github/testing-library/angular-testing-library
[coverage-badge]: https://img.shields.io/codecov/c/github/testing-library/angular-testing-library.svg?style=flat-square
[version-badge]: https://img.shields.io/npm/v/@angular-extensions/testing-library.svg?style=flat-square
[package]: https://www.npmjs.com/package/@angular-extensions/testing-library
[downloads-badge]: https://img.shields.io/npm/dm/@angular-extensions/testing-library.svg?style=flat-square
[npmtrends]: http://www.npmtrends.com/@angular-extensions/testing-library
[version-badge]: https://img.shields.io/npm/v/@testing-library/angular.svg?style=flat-square
[package]: https://www.npmjs.com/package/@testing-library/angular
[downloads-badge]: https://img.shields.io/npm/dm/@testing-library/angular.svg?style=flat-square
[npmtrends]: http://www.npmtrends.com/@testing-library/angular
[spectrum-badge]: https://withspectrum.github.io/badge/badge.svg
[spectrum]: https://spectrum.chat/testing-library
[license-badge]: https://img.shields.io/npm/l/@angular-extensions/testing-library.svg?style=flat-square
[license-badge]: https://img.shields.io/npm/l/@testing-library/angular.svg?style=flat-square
[license]: https://github.com/testing-library/angular-testing-library/blob/master/LICENSE
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[prs]: http://makeapullrequest.com
Expand All @@ -249,7 +249,7 @@ Links:
[github-watch]: https://github.com/testing-library/angular-testing-library/watchers
[github-star-badge]: https://img.shields.io/github/stars/testing-library/angular-testing-library.svg?style=social
[github-star]: https://github.com/testing-library/angular-testing-library/stargazers
[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20🦔%20@angular-extensions/testing-library%20by%20%40tim_deschryver%20https%3A%2F%2Fgithub.com%2F@angular-extensions/testing-library
[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20🦔%20@testing-library/angular%20by%20%40tim_deschryver%20https%3A%2F%2Fgithub.com%2F@testing-library/angular
[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/testing-library/angular-testing-library.svg?style=social
[emojis]: https://github.com/all-contributors/all-contributors#emoji-key
[all-contributors]: https://github.com/all-contributors/all-contributors
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@angular-extensions/testing-library-app",
"name": "@testing-library/angular-app",
"version": "0.0.0-semantically-released",
"scripts": {
"ng": "ng",
Expand All @@ -8,8 +8,8 @@
"build": "npm run build:library && npm run build:library:jest-utils && npm run build:migrations && npm run build:readme",
"build:library": "ng build --prod testing-library",
"build:library:jest-utils": "ng build --prod jest-utils",
"build:migrations": "tsc -p ./projects/testing-library/migrations/tsconfig.migrations.json && cp ./projects/testing-library/migrations/migration.json ./dist/@angular-extensions/testing-library/migrations",
"build:readme": "cp ./README.md ./dist/@angular-extensions/testing-library",
"build:migrations": "tsc -p ./projects/testing-library/migrations/tsconfig.migrations.json && cp ./projects/testing-library/migrations/migration.json ./dist/@testing-library/angular/migrations",
"build:readme": "cp ./README.md ./dist/@testing-library/angular",
"test": "jest --config ./projects/jest.lib.config.js",
"test:app": "jest --config ./src/jest.app.config.js",
"precommit": "lint-staged",
Expand All @@ -23,7 +23,7 @@
]
},
"release": {
"pkgRoot": "dist/@angular-extensions/testing-library"
"pkgRoot": "dist/@testing-library/angular"
},
"dependencies": {
"@angular/animations": "^8.0.0",
Expand All @@ -35,8 +35,8 @@
"@angular/platform-browser-dynamic": "^8.0.0",
"@angular/router": "^8.0.0",
"@phenomnomnominal/tsquery": "^3.0.0",
"@testing-library/dom": "^5.0.1",
"core-js": "^3.1.3",
"dom-testing-library": "^4.1.1",
"rxjs": "^6.5.2",
"tslint": "^5.16.0",
"zone.js": "~0.9.1"
Expand All @@ -47,8 +47,8 @@
"@angular/cli": "~8.0.0",
"@angular/compiler-cli": "^8.0.0",
"@angular/language-service": "^8.0.0",
"@types/node": "~12.0.3",
"@types/jest": "~24.0.11",
"@types/node": "~12.0.3",
"codelyzer": "^5.0.1",
"husky": "^2.3.0",
"jest": "^24.1.0",
Expand Down
2 changes: 1 addition & 1 deletion projects/jest-utils/ng-package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../@angular-extensions/testing-library/jest-utils",
"dest": "../../@testing-library/angular/jest-utils",
"deleteDestPath": false,
"lib": {
"entryFile": "src/public_api.ts"
Expand Down
2 changes: 1 addition & 1 deletion projects/jest-utils/ng-package.prod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/@angular-extensions/testing-library/jest-utils",
"dest": "../../dist/@testing-library/angular/jest-utils",
"deleteDestPath": false,
"lib": {
"entryFile": "src/public_api.ts"
Expand Down
11 changes: 5 additions & 6 deletions projects/jest-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@angular-extensions/testing-library/jest-utils",
"name": "@testing-library/angular/jest-utils",
"version": "0.0.0-semantically-released",
"description": "Test your Angular components with the dom-testing-library",
"repository": {
"type": "git",
"url": "git+https://github.com/angular-extensions/testing-library.git"
"url": "git+https://github.com/testing-library/angular-testing-library.git"
},
"keywords": [
"angular",
Expand All @@ -13,15 +13,14 @@
"typescript",
"angular2",
"test",
"dom-testing-library",
"angular-extensions"
"dom-testing-library"
],
"author": "Tim Deschryver",
"license": "MIT",
"bugs": {
"url": "https://github.com/angular-extensions/testing-library/issues"
"url": "https://github.com/testing-library/angular-testing-library/issues"
},
"homepage": "https://github.com/angular-extensions/testing-library#readme",
"homepage": "https://github.com/testing-library/angular-testing-library#readme",
"peerDependencies": {
"jest": ">=23.4.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"target": "es5",
"sourceMap": true,
"rootDir": "./",
"outDir": "../../../dist/@angular-extensions/testing-library/migrations",
"outDir": "../../../dist/@testing-library/angular/migrations",
"noLib": false,
"baseUrl": "./",
"experimentalDecorators": true,
Expand Down
4 changes: 2 additions & 2 deletions projects/testing-library/ng-package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/@angular-extensions/testing-library",
"dest": "../../dist/@testing-library/angular",
"deleteDestPath": false,
"lib": {
"entryFile": "src/public_api.ts"
},
"whitelistedNonPeerDependencies": ["dom-testing-library", "@phenomnomnominal/tsquery", "tslint"]
"whitelistedNonPeerDependencies": ["@testing-library/dom", "@phenomnomnominal/tsquery", "tslint"]
}
4 changes: 2 additions & 2 deletions projects/testing-library/ng-package.prod.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/@angular-extensions/testing-library",
"dest": "../../dist/@testing-library/angular",
"deleteDestPath": false,
"lib": {
"entryFile": "src/public_api.ts"
},
"whitelistedNonPeerDependencies": ["dom-testing-library", "@phenomnomnominal/tsquery", "tslint"]
"whitelistedNonPeerDependencies": ["@testing-library/dom", "@phenomnomnominal/tsquery", "tslint"]
}
7 changes: 3 additions & 4 deletions projects/testing-library/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@angular-extensions/testing-library",
"name": "@testing-library/angular",
"version": "0.0.0-semantically-released",
"description": "Test your Angular components with the dom-testing-library",
"repository": {
Expand All @@ -13,8 +13,7 @@
"typescript",
"angular2",
"test",
"dom-testing-library",
"angular-extensions"
"dom-testing-library"
],
"author": "Tim Deschryver",
"license": "MIT",
Expand All @@ -27,7 +26,7 @@
"@angular/core": "^8.0.0"
},
"dependencies": {
"dom-testing-library": "^4.1.0",
"@testing-library/dom": "^5.1.0",
"@phenomnomnominal/tsquery": "^3.0.0",
"tslint": "^5.16.0"
},
Expand Down
2 changes: 1 addition & 1 deletion projects/testing-library/src/lib/models.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Type } from '@angular/core';
import { ComponentFixture } from '@angular/core/testing';
import { FireObject, Queries, queries, BoundFunction } from 'dom-testing-library';
import { FireObject, Queries, queries, BoundFunction } from '@testing-library/dom';

export type RenderResultQueries<Q extends Queries = typeof queries> = { [P in keyof Q]: BoundFunction<Q[P]> };

Expand Down
2 changes: 1 addition & 1 deletion projects/testing-library/src/lib/testing-library.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, OnInit, ElementRef, Type, DebugElement } from '@angular/core';
import { By } from '@angular/platform-browser';
import { TestBed, ComponentFixture } from '@angular/core/testing';
import { getQueriesForElement, prettyDOM, fireEvent, FireObject, FireFunction } from 'dom-testing-library';
import { getQueriesForElement, prettyDOM, fireEvent, FireObject, FireFunction } from '@testing-library/dom';
import { RenderResult, RenderOptions } from './models';

@Component({ selector: 'wrapper-component', template: '' })
Expand Down
2 changes: 1 addition & 1 deletion projects/testing-library/src/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

export * from './lib/models';
export * from './lib/testing-library';
export * from 'dom-testing-library';
export * from '@testing-library/dom';
12 changes: 6 additions & 6 deletions projects/testing-library/tests/migration/4_0_0.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('Migration to version 4.0.0', () => {
{
description: 'template syntax',
input: virtualFs.stringToFileBuffer(`
import { createComponent } from '@angular-extensions/testing-library';
import { createComponent } from '@testing-library/angular';
import { HomeComponent } from './home.component';
async function setup() {
Expand All @@ -18,7 +18,7 @@ describe('Migration to version 4.0.0', () => {
});
}`),
expected: `
import { render } from '@angular-extensions/testing-library';
import { render } from '@testing-library/angular';
import { HomeComponent } from './home.component';
async function setup() {
Expand All @@ -30,7 +30,7 @@ describe('Migration to version 4.0.0', () => {
{
description: 'component syntax',
input: virtualFs.stringToFileBuffer(`
import { createComponent } from '@angular-extensions/testing-library';
import { createComponent } from '@testing-library/angular';
import { HomeComponent } from './home.component';
async function setup() {
Expand All @@ -44,7 +44,7 @@ describe('Migration to version 4.0.0', () => {
);
}`),
expected: `
import { render } from '@angular-extensions/testing-library';
import { render } from '@testing-library/angular';
import { HomeComponent } from './home.component';
async function setup() {
Expand All @@ -59,7 +59,7 @@ describe('Migration to version 4.0.0', () => {
{
description: 'component syntax with properties',
input: virtualFs.stringToFileBuffer(`
import { createComponent } from '@angular-extensions/testing-library';
import { createComponent } from '@testing-library/angular';
import { HomeComponent } from './home.component';
async function setup() {
Expand All @@ -77,7 +77,7 @@ describe('Migration to version 4.0.0', () => {
);
}`),
expected: `
import { render } from '@angular-extensions/testing-library';
import { render } from '@testing-library/angular';
import { HomeComponent } from './home.component';
async function setup() {
Expand Down
4 changes: 2 additions & 2 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppComponent } from './app.component';
import { render } from '@angular-extensions/testing-library';
import { configureJestSetup } from '@angular-extensions/testing-library/jest-utils';
import { render } from '@testing-library/angular';
import { configureJestSetup } from '@testing-library/angular/jest-utils';

configureJestSetup();

Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"typeRoots": ["node_modules/@types"],
"lib": ["es2017", "dom"],
"paths": {
"@angular-extensions/testing-library": ["dist/@angular-extensions/testing-library"],
"@angular-extensions/testing-library/*": ["dist/@angular-extensions/testing-library/*"]
"@testing-library/angular": ["dist/@testing-library/angular"],
"@testing-library/angular/*": ["dist/@testing-library/angular/*"]
}
}
}
26 changes: 13 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"

"@babel/runtime@^7.0.0", "@babel/runtime@^7.4.3":
"@babel/runtime@^7.0.0", "@babel/runtime@^7.4.5":
version "7.4.5"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.4.5.tgz#582bb531f5f9dc67d2fcb682979894f75e253f12"
integrity sha512-TuI4qpWZP6lGOGIuGWtp9sPluqYICmbk8T/1vpSysqJxRPkudh/ofFWyqdcMsDf2s7KvDL4/YHgKyvcS3g9CJQ==
Expand Down Expand Up @@ -707,6 +707,16 @@
dependencies:
defer-to-connect "^1.0.1"

"@testing-library/dom@^5.0.1":
version "5.0.1"
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-5.0.1.tgz#1673a56f27fd9748576495958a27b0e5a408db5d"
integrity sha512-HmyN4b/PmSaSB1ku0tWjgnTtyrwNBXEpp44wgfNaDhyj6IJTCWp1GAf4AANoLGItgMsYjepwWOdMyuJ/8iyStQ==
dependencies:
"@babel/runtime" "^7.4.5"
"@sheerun/mutationobserver-shim" "^0.3.2"
pretty-format "^24.8.0"
wait-for-expect "^1.2.0"

"@types/babel__core@^7.1.0":
version "7.1.2"
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.2.tgz#608c74f55928033fce18b99b213c16be4b3d114f"
Expand Down Expand Up @@ -3066,16 +3076,6 @@ dns-txt@^2.0.2:
dependencies:
buffer-indexof "^1.0.0"

dom-testing-library@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/dom-testing-library/-/dom-testing-library-4.1.1.tgz#615af61bee06db51bd8ecea60c113eba7cb49dda"
integrity sha512-PUsG7aY5BJxzulDrOtkksqudRRypcVQF6d4RGAyj9xNwallOFqrNLOyg2QW2mCpFaNVPELX8hBX/wbHQtOto/A==
dependencies:
"@babel/runtime" "^7.4.3"
"@sheerun/mutationobserver-shim" "^0.3.2"
pretty-format "^24.7.0"
wait-for-expect "^1.1.1"

domain-browser@^1.1.1:
version "1.2.0"
resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda"
Expand Down Expand Up @@ -7757,7 +7757,7 @@ prettier@^1.17.1:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.17.1.tgz#ed64b4e93e370cb8a25b9ef7fef3e4fd1c0995db"
integrity sha512-TzGRNvuUSmPgwivDqkZ9tM/qTGW9hqDKWOE9YHiyQdixlKbv7kvEqsmDPrcHJTKwthU774TQwZXVtaQ/mMsvjg==

pretty-format@^24.0.0, pretty-format@^24.7.0, pretty-format@^24.8.0:
pretty-format@^24.0.0, pretty-format@^24.8.0:
version "24.8.0"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.8.0.tgz#8dae7044f58db7cb8be245383b565a963e3c27f2"
integrity sha512-P952T7dkrDEplsR+TuY7q3VXDae5Sr7zmQb12JU/NDQa/3CH7/QW0yvqLcGN6jL+zQFKaoJcPc+yJxMTGmosqw==
Expand Down Expand Up @@ -10166,7 +10166,7 @@ w3c-xmlserializer@^1.0.1:
webidl-conversions "^4.0.2"
xml-name-validator "^3.0.0"

wait-for-expect@^1.1.1:
wait-for-expect@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/wait-for-expect/-/wait-for-expect-1.2.0.tgz#fdab6a26e87d2039101db88bff3d8158e5c3e13f"
integrity sha512-EJhKpA+5UHixduMBEGhTFuLuVgQBKWxkFbefOdj2bbk2/OpA5Opsc4aUTGmF+qJ+v3kTGxDRNYwKaT4j6g5n8Q==
Expand Down

0 comments on commit 7f1dce6

Please sign in to comment.