Skip to content

Commit a351b11

Browse files
committed
More cleanup, node tests
1 parent 7d50f50 commit a351b11

14 files changed

+151
-75
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ install:
4141
script:
4242
- |
4343
- yarn build &&
44-
npx ng test --watch=false --browsers=ChromeHeadless &&
44+
yarn test:headless &&
45+
yarn test:node &&
4546
node tools/run-typings-test.js &&
4647
bash ./test/ng-build/build.sh

angular.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"build": {
1313
"builder": "@angular-devkit/build-ng-packagr:build",
1414
"options": {
15-
"tsConfig": "tsconfig.lib.json",
15+
"tsConfig": "tsconfig.json",
1616
"project": "src/package.json"
1717
}
1818
},
@@ -28,7 +28,7 @@
2828
"builder": "@angular-devkit/build-angular:tslint",
2929
"options": {
3030
"tsConfig": [
31-
"tsconfig.lib.json",
31+
"tsconfig.json",
3232
"tsconfig.spec.json"
3333
],
3434
"exclude": [

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
"description": "The official library of Firebase and Angular.",
55
"private": true,
66
"scripts": {
7-
"test": "npm run build && npx ng test",
7+
"test": "npx ng test",
8+
"test:headless": "npx ng test --watch=false --browsers=ChromeHeadless",
89
"lint": "npx ng lint",
9-
"test:node": "jasmine 'dist/packages-dist/schematics/**/*[sS]pec.js'",
10-
"test:universal": "npm run build && cp -R dist/packages-dist test/universal-test/node_modules/angularfire2 && cd test/universal-test && npm run prerender",
10+
"test:node": "npx tsc -p tsconfig.jasmine.json && node -r tsconfig-paths/register ./tools/jasmine.js",
11+
"test:typings": "node ./tools/run-typings-test.js",
12+
"test:build": "bash ./test/ng-build/build.sh",
13+
"test:universal": "cp -R dist/packages-dist test/universal-test/node_modules/angularfire2 && cd test/universal-test && npm run prerender",
14+
"test:all": "npm run test:headless && npm run test:node && npm run test:typings && npm run test:build",
1115
"build": "tsc tools/build.ts; node ./tools/build.js",
1216
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1"
1317
},
@@ -83,6 +87,7 @@
8387
"reflect-metadata": "0.1.2",
8488
"rimraf": "^2.5.4",
8589
"schematics-utilities": "^1.1.1",
90+
"tsconfig-paths": "^3.8.0",
8691
"tsickle": "^0.35.0",
8792
"tslint": "^5.17.0",
8893
"typescript": ">=3.4.0 <3.5.0"

src/schematics/deploy/actions.spec.ts renamed to src/schematics/deploy/actions.jasmine.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { JsonObject, logging } from '@angular-devkit/core';
2-
import { BuilderContext, BuilderRun, ScheduleOptions, Target, } from '@angular-devkit/architect/src/index2';
3-
import { FirebaseTools, FirebaseDeployConfig } from 'schematics/interfaces';
2+
import { BuilderContext, BuilderRun, ScheduleOptions, Target, } from '@angular-devkit/architect';
3+
import { FirebaseTools, FirebaseDeployConfig } from '../interfaces';
44
import deploy from './actions';
55

66

@@ -80,7 +80,7 @@ const initMocks = () => {
8080
use: () => Promise.resolve()
8181
};
8282

83-
context = {
83+
context = <any>{
8484
target: {
8585
configuration: 'production',
8686
project: PROJECT,
File renamed without changes.

test/ng-build/build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
cd ./test/ng-build/ng6 && yarn && npx ng build --prod &&
2-
cd ../ng7 && yarn && npx ng build --prod &&
3-
cd ../ng8 && yarn && npx ng build --prod
1+
cd ./test/ng-build/ng6 && yarn && npx ng build --prod --aot &&
2+
cd ../ng7 && yarn && npx ng build --prod --aot &&
3+
cd ../ng8 && yarn && npx ng build --prod --aot

tools/jasmine.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Jasmine = require('jasmine');
2+
3+
jasmine = new Jasmine();
4+
jasmine.loadConfig({
5+
spec_dir: '.',
6+
spec_files: [
7+
'dist/out-tsc/jasmine/**/*.jasmine.js',
8+
'dist/out-tsc/jasmine/**/*.spec.js'
9+
]
10+
});
11+
12+
require('reflect-metadata');
13+
require('zone.js/dist/zone-node');
14+
require('zone.js/dist/async-test');
15+
require('zone.js/dist/sync-test');
16+
require('zone.js/dist/fake-async-test');
17+
require('zone.js/dist/proxy');
18+
19+
const { getTestBed } = require('@angular/core/testing');
20+
const { platformServerTesting, ServerTestingModule } = require('@angular/platform-server/testing');
21+
22+
// First, initialize the Angular testing environment.
23+
getTestBed().initTestEnvironment(
24+
ServerTestingModule,
25+
platformServerTesting()
26+
);
27+
28+
jasmine.execute();

tools/test.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ apt-get -y update
55
apt-get -y install google-chrome-stable
66

77
# TODO parallelize these
8-
npx ng test --watch=false --browsers=ChromeHeadless &&
9-
node tools/run-typings-test.js &&
10-
bash ./test/ng-build/build.sh
8+
yarn test:headless &&
9+
yarn test:node &&
10+
yarn test:typings &&
11+
yarn test:build

tsconfig.base.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"compileOnSave": false,
3+
"compilerOptions": {
4+
"baseUrl": "./",
5+
"outDir": "./dist",
6+
"sourceMap": true,
7+
"declaration": false,
8+
"downlevelIteration": true,
9+
"emitDecoratorMetadata": true,
10+
"experimentalDecorators": true,
11+
"module": "esnext",
12+
"moduleResolution": "node",
13+
"importHelpers": true,
14+
"target": "es2015",
15+
"typeRoots": [
16+
"node_modules/@types"
17+
],
18+
"lib": [
19+
"es2018",
20+
"dom"
21+
],
22+
"paths": {
23+
"@angular/fire": ["dist/packages-dist"],
24+
"@angular/fire/auth": ["dist/packages-dist/auth"],
25+
"@angular/fire/auth-guard": ["dist/packages-dist/auth-guard"],
26+
"@angular/fire/database": ["dist/packages-dist/database"],
27+
"@angular/fire/database-deprecated": ["dist/packages-dist/database-deprecated"],
28+
"@angular/fire/firebase-node": ["dist/packages-dist/firebase-node"],
29+
"@angular/fire/firestore": ["dist/packages-dist/firestore"],
30+
"@angular/fire/functions": ["dist/packages-dist/functions"],
31+
"@angular/fire/messaging": ["dist/packages-dist/messaging"],
32+
"@angular/fire/performance": ["dist/packages-dist/performance"],
33+
"@angular/fire/storage": ["dist/packages-dist/storage"]
34+
}
35+
}
36+
}

tsconfig.jasmine.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"compilerOptions": {
4+
"outDir": "dist/out-tsc/jasmine",
5+
"module": "none",
6+
"target": "es2015",
7+
"allowJs": true,
8+
"types": [
9+
"jasmine",
10+
"node"
11+
]
12+
},
13+
"include": [
14+
"src/**/*.jasmine.ts",
15+
"src/**/*.spec.ts",
16+
"src/**/*.d.ts",
17+
"node_modules/zone.js/dist/zone.js.d.ts"
18+
]
19+
}
20+

tsconfig.json

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,27 @@
11
{
2-
"compileOnSave": false,
2+
"extends": "./tsconfig.base.json",
33
"compilerOptions": {
4-
"baseUrl": "./",
5-
"outDir": "./dist",
6-
"sourceMap": true,
7-
"declaration": false,
8-
"downlevelIteration": true,
9-
"emitDecoratorMetadata": true,
10-
"experimentalDecorators": true,
11-
"module": "esnext",
12-
"moduleResolution": "node",
13-
"importHelpers": true,
4+
"outDir": "dist/out-tsc/lib",
145
"target": "es2015",
15-
"typeRoots": [
16-
"node_modules/@types"
17-
],
6+
"declaration": true,
7+
"inlineSources": true,
8+
"types": [],
189
"lib": [
19-
"es2018",
20-
"dom"
21-
],
22-
"paths": {
23-
"@angular/fire": ["dist/packages-dist"],
24-
"@angular/fire/auth": ["dist/packages-dist/auth"],
25-
"@angular/fire/auth-guard": ["dist/packages-dist/auth-guard"],
26-
"@angular/fire/database": ["dist/packages-dist/database"],
27-
"@angular/fire/database-deprecated": ["dist/packages-dist/database-deprecated"],
28-
"@angular/fire/firebase-node": ["dist/packages-dist/firebase-node"],
29-
"@angular/fire/firestore": ["dist/packages-dist/firestore"],
30-
"@angular/fire/functions": ["dist/packages-dist/functions"],
31-
"@angular/fire/messaging": ["dist/packages-dist/messaging"],
32-
"@angular/fire/performance": ["dist/packages-dist/performance"],
33-
"@angular/fire/storage": ["dist/packages-dist/storage"]
34-
}
35-
}
36-
}
10+
"dom",
11+
"es2018"
12+
]
13+
},
14+
"angularCompilerOptions": {
15+
"annotateForClosureCompiler": true,
16+
"skipTemplateCodegen": true,
17+
"strictMetadataEmit": true,
18+
"fullTemplateTypeCheck": true,
19+
"strictInjectionParameters": true,
20+
"enableResourceInlining": true
21+
},
22+
"exclude": [
23+
"src/test.ts",
24+
"src/**/*.spec.ts"
25+
]
26+
}
27+

tsconfig.lib.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

tsconfig.spec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "./tsconfig.json",
2+
"extends": "./tsconfig.base.json",
33
"compilerOptions": {
44
"outDir": "dist/out-tsc/spec",
55
"types": [

yarn.lock

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,11 @@
642642
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-3.3.13.tgz#d5daabb0af47bcddee40597acf6e804433bab439"
643643
integrity sha512-iczmLoIiVymaD1TIr2UctxjFkNEslVE/QtNAUmpDsD71cZfZBAsPCUv1Y+8AwsfA8bLx2ccr7d95T9w/UAirlQ==
644644

645+
"@types/json5@^0.0.29":
646+
version "0.0.29"
647+
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
648+
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4=
649+
645650
"@types/long@^4.0.0":
646651
version "4.0.0"
647652
resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.0.tgz#719551d2352d301ac8b81db732acb6bdc28dbdef"
@@ -3175,6 +3180,11 @@ deep-extend@^0.6.0:
31753180
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"
31763181
integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==
31773182

3183+
deepmerge@^2.0.1:
3184+
version "2.2.1"
3185+
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-2.2.1.tgz#5d3ff22a01c00f645405a2fbc17d0778a1801170"
3186+
integrity sha512-R9hc1Xa/NOBi9WRVUWg19rl1UB7Tt4kuPd+thNJgFZoxXsTz7ncaPaeIm+40oSGuP33DfMb4sZt1QIGiJzC4EA==
3187+
31783188
default-gateway@^4.2.0:
31793189
version "4.2.0"
31803190
resolved "https://registry.yarnpkg.com/default-gateway/-/default-gateway-4.2.0.tgz#167104c7500c2115f6dd69b0a536bb8ed720552b"
@@ -9732,6 +9742,17 @@ try-require@^1.0.0:
97329742
resolved "https://registry.yarnpkg.com/try-require/-/try-require-1.2.1.tgz#34489a2cac0c09c1cc10ed91ba011594d4333be2"
97339743
integrity sha1-NEiaLKwMCcHMEO2RugEVlNQzO+I=
97349744

9745+
tsconfig-paths@^3.8.0:
9746+
version "3.8.0"
9747+
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.8.0.tgz#4e34202d5b41958f269cf56b01ed95b853d59f72"
9748+
integrity sha512-zZEYFo4sjORK8W58ENkRn9s+HmQFkkwydDG7My5s/fnfr2YYCaiyXe/HBUcIgU8epEKOXwiahOO+KZYjiXlWyQ==
9749+
dependencies:
9750+
"@types/json5" "^0.0.29"
9751+
deepmerge "^2.0.1"
9752+
json5 "^1.0.1"
9753+
minimist "^1.2.0"
9754+
strip-bom "^3.0.0"
9755+
97359756
tsickle@^0.35.0:
97369757
version "0.35.0"
97379758
resolved "https://registry.yarnpkg.com/tsickle/-/tsickle-0.35.0.tgz#59235df45937c0ec5d072c616c26d2d97fba54b9"

0 commit comments

Comments
 (0)