Skip to content

Commit

Permalink
feat: angular 10 support
Browse files Browse the repository at this point in the history
BREAKING CHANGE: A10

closes #148, #149
  • Loading branch information
satanTime committed Jul 2, 2020
1 parent 466d5ca commit e3e03a0
Show file tree
Hide file tree
Showing 383 changed files with 134,200 additions and 393 deletions.
20 changes: 14 additions & 6 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
/coverage
/dist
/node_modules
/e2e/angular5/node_modules
/e2e/angular6/node_modules
/e2e/angular7/node_modules
/e2e/angular8/node_modules
/e2e/angular9-ivy-false/node_modules
/e2e/angular9-ivy-true/node_modules
/e2e/a5es5/node_modules
/e2e/a5es2015/node_modules
/e2e/a6es5/node_modules
/e2e/a6es2015/node_modules
/e2e/a7es5/node_modules
/e2e/a7es2015/node_modules
/e2e/a8es5/node_modules
/e2e/a8es2015/node_modules
/e2e/a9es5ivy/node_modules
/e2e/a9es5noivy/node_modules
/e2e/a9es2015ivy/node_modules
/e2e/a9es2015noivy/node_modules
/e2e/a10es2015ivy/node_modules
/e2e/a10es2015noivy/node_modules
141 changes: 132 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,140 @@ git:
autocrlf: false
install:
- npm install
script:
- npm run test:angular-versions
jobs:
include:
- name: 'Unit Tests'
script:
- npm run test:angular-versions
- name: 'e2e a5 es5'
script:
- npm install
- npm run build
- npm run i:a5es5
- npm run s:a5es5
- npm run s:test:a5es5
- npm run test:a5es5
- npm run clear:a5es5
- name: 'e2e a5 es2015'
script:
- npm install
- npm run build
- npm run i:a5es2015
- npm run s:a5es2015
- npm run s:test:a5es2015
- npm run test:a5es2015
- npm run clear:a5es2015
- name: 'e2e a6 es5'
script:
- npm install
- npm run build
- npm run i:a6es5
- npm run s:a6es5
- npm run s:test:a6es5
- npm run test:a6es5
- npm run clear:a6es5
- name: 'e2e a6 es2015'
script:
- npm install
- npm run build
- npm run i:a6es2015
- npm run s:a6es2015
- npm run s:test:a6es2015
- npm run test:a6es2015
- npm run clear:a6es2015
- name: 'e2e a7 es5'
script:
- npm install
- npm run build
- npm run i:a7es5
- npm run s:a7es5
- npm run s:test:a7es5
- npm run test:a7es5
- npm run clear:a7es5
- name: 'e2e a7 es2015'
script:
- npm install
- npm run build
- npm run i:a7es2015
- npm run s:a7es2015
- npm run s:test:a7es2015
- npm run test:a7es2015
- npm run clear:a7es2015
- name: 'e2e a8 es5'
script:
- npm install
- npm run build
- npm run i:a8es5
- npm run s:a8es5
- npm run s:test:a8es5
- npm run test:a8es5
- npm run clear:a8es5
- name: 'e2e a8 es2015'
script:
- npm install
- npm run build
- npm run i:a8es2015
- npm run s:a8es2015
- npm run s:test:a8es2015
- npm run test:a8es2015
- npm run clear:a8es2015
- name: 'e2e a9 es5 ivy'
script:
- npm install
- npm run build
- npm run i:a9es5ivy
- npm run s:a9es5ivy
- npm run s:test:a9es5ivy
- npm run test:a9es5ivy
- npm run clear:a9es5ivy
- name: 'e2e a9 es5 no-ivy'
script:
- npm install
- npm run build
- npm run i:a9es5noivy
- npm run s:a9es5noivy
- npm run s:test:a9es5noivy
- npm run test:a9es5noivy
- npm run clear:a9es5noivy
- name: 'e2e a9 es2015 ivy'
script:
- npm install
- npm run build
- npm run i:a9es2015ivy
- npm run s:a9es2015ivy
- npm run s:test:a9es2015ivy
- npm run test:a9es2015ivy
- npm run clear:a9es2015ivy
- name: 'e2e a9 es2015 no-ivy'
script:
- npm install
- npm run build
- npm run i:a9es2015noivy
- npm run s:a9es2015noivy
- npm run s:test:a9es2015noivy
- npm run test:a9es2015noivy
- npm run clear:a9es2015noivy
- name: 'e2e a10 es2015 ivy'
script:
- npm install
- npm run build
- npm run i:a10es2015ivy
- npm run s:a10es2015ivy
- npm run s:test:a10es2015ivy
- npm run test:a10es2015ivy
- npm run clear:a10es2015ivy
- name: 'e2e a10 es2015 no-ivy'
script:
- npm install
- npm run build
- npm run i:a10es2015noivy
- npm run s:a10es2015noivy
- npm run s:test:a10es2015noivy
- npm run test:a10es2015noivy
- npm run clear:a10es2015noivy
cache:
npm: false
npm: true
directories:
- $HOME/.npm
- $HOME/.node-gyp
- node_modules
- e2e/angular5/node_modules
- e2e/angular6/node_modules
- e2e/angular7/node_modules
- e2e/angular8/node_modules
- e2e/angular9-ivy-false/node_modules
- e2e/angular9-ivy-true/node_modules
20 changes: 14 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@ CMD ["sh", "build-with-supported-angluars.sh"]

VOLUME /npm
VOLUME /app/node_modules
VOLUME /app/e2e/angular5/node_modules
VOLUME /app/e2e/angular6/node_modules
VOLUME /app/e2e/angular7/node_modules
VOLUME /app/e2e/angular8/node_modules
VOLUME /app/e2e/angular9-ivy-false/node_modules
VOLUME /app/e2e/angular9-ivy-true/node_modules
VOLUME /app/e2e/a5es5/node_modules
VOLUME /app/e2e/a5es2015/node_modules
VOLUME /app/e2e/a6es5/node_modules
VOLUME /app/e2e/a6es2015/node_modules
VOLUME /app/e2e/a7es5/node_modules
VOLUME /app/e2e/a7es2015/node_modules
VOLUME /app/e2e/a8es5/node_modules
VOLUME /app/e2e/a8es2015/node_modules
VOLUME /app/e2e/a9es5ivy/node_modules
VOLUME /app/e2e/a9es5noivy/node_modules
VOLUME /app/e2e/a9es2015ivy/node_modules
VOLUME /app/e2e/a9es2015noivy/node_modules
VOLUME /app/e2e/a10es2015ivy/node_modules
VOLUME /app/e2e/a10es2015noivy/node_modules

RUN npm config set cache /npm --global

Expand Down
33 changes: 26 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ Helper function for creating angular mocks for test.

Tested on:

- Angular 5 (Jasmine, Jest)
- Angular 6 (Jasmine, Jest)
- Angular 7 (Jasmine, Jest)
- Angular 8 (Jasmine, Jest)
- Angular 9 (Jasmine, Jest, Ivy)
- Angular 5 (Jasmine, Jest, es5, es2015)
- Angular 6 (Jasmine, Jest, es5, es2015)
- Angular 7 (Jasmine, Jest, es5, es2015)
- Angular 8 (Jasmine, Jest, es5, es2015)
- Angular 9 (Jasmine, Jest, Ivy, es5, es2015)
- Angular 10 (Jasmine, Jest, Ivy, es2015)

## Why use this?

Expand Down Expand Up @@ -147,6 +148,8 @@ Our tests:
- [Structural Components](#usage-example-of-structural-directives)
- [Auto Spy](#auto-spy)

* [Troubleshooting](#troubleshooting)

---

## MockComponent(s)
Expand Down Expand Up @@ -548,9 +551,9 @@ import { MyModule } from './fixtures.modules';
describe('MockBuilder:simple', () => {
beforeEach(() => MockBuilder(MyComponent, MyModule));
// the same as
// beforeEach(() => TestBed.configureTestingModule({{
// TestBed.configureTestingModule({{
// imports: [MockModule(MyModule)], // but MyComponent wasn't mocked for the testing purposes.
// }).compileComponents());
// }).compileComponents();
// and we can simply pass it to the TestBed.

it('should render content ignoring all dependencies', () => {
Expand Down Expand Up @@ -803,6 +806,10 @@ describe('MockRender', () => {

ngMocks provides functions to get attribute and structural directives from an element, find components and mock objects.

- ngMocks.mockedComponent(instance)
- ngMocks.mockedDirective(instance)
- ngMocks.mockedPipe(instance)

- ngMocks.get(debugElement, directive, notFoundValue?)
- ngMocks.findInstance(debugElement, directive, notFoundValue?)
- ngMocks.findInstances(debugElement, directive)
Expand Down Expand Up @@ -942,6 +949,18 @@ import 'ng-mocks/dist/jest';

---

## Troubleshooting

### Angular 10 throws "TS2339: Property '\*' does not exist on type ..."

Instead of using `instance.__*` the `instance` should be wrapped by:

- `ngMocks.mockedComponent(instance).__*`
- `ngMocks.mockedDirective(instance).__*`
- `ngMocks.mockedPipe(instance).__*`

---

## Find an issue or have a request?

Report it as an issue or submit a PR. I'm open to contributions.
Expand Down
14 changes: 7 additions & 7 deletions build-with-supported-angluars.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
set -e
VERSIONS="5 6 7 8 9"
VERSIONS="5 6 7 8 9 10"
PACKAGES="animations common compiler core forms platform-browser platform-browser-dynamic router"

for version in $VERSIONS
Expand All @@ -14,11 +14,12 @@ do
NEW="$NEW @angular/$package@$version"
done

echo $version | grep -Eq "^5" && NEW="$NEW rxjs@5.5.5 zone.js@0.8.14 typescript@2.4"
echo $version | grep -Eq "^6" && NEW="$NEW rxjs@6.0.0 zone.js@0.8.26 typescript@2.7"
echo $version | grep -Eq "^7" && NEW="$NEW rxjs@6.0.0 zone.js@0.8.26 typescript@3.1"
echo $version | grep -Eq "^8" && NEW="$NEW rxjs@6.4.0 zone.js@0.9.1 typescript@3.4.3"
echo $version | grep -Eq "^9" && NEW="$NEW rxjs@6.5.3 zone.js@0.10.2 typescript@3.6.4"
echo $version | grep -Eq "^5$" && NEW="$NEW rxjs@5.5.5 zone.js@0.8.14 typescript@2.4"
echo $version | grep -Eq "^6$" && NEW="$NEW rxjs@6.0.0 zone.js@0.8.26 typescript@2.7"
echo $version | grep -Eq "^7$" && NEW="$NEW rxjs@6.0.0 zone.js@0.8.26 typescript@3.1"
echo $version | grep -Eq "^8$" && NEW="$NEW rxjs@6.4.0 zone.js@0.9.1 typescript@3.4.3"
echo $version | grep -Eq "^9$" && NEW="$NEW rxjs@6.5.3 zone.js@0.10.2 typescript@3.6.4"
echo $version | grep -Eq "^10$" && NEW="$NEW rxjs@6.5.5 zone.js@0.10.3 typescript@3.9.5"

echo $NEW

Expand All @@ -27,5 +28,4 @@ do
npm run build:all
done
npm install --silent --quiet --no-progress
npm run e2e
echo Testing complete
17 changes: 17 additions & 0 deletions e2e/a10es2015ivy/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support

# You can see what browsers were selected by your queries by running:
# npx browserslist

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major version
last 2 iOS major versions
Firefox ESR
not IE 9-11 # For IE 9-11 support, remove 'not'.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit e3e03a0

Please sign in to comment.