fix: add typescript test for our typings (#9096)
* Revert "fix(d.ts): enable angular2 compilation with TS flag --strictNullChecks (#8902)"
This reverts commit 7e352a27f7
.
* test: add typescript test for our typings
This commit is contained in:
parent
50acb96130
commit
87d824e1b4
|
@ -26,7 +26,7 @@ export interface ClassDefinition {
|
|||
* Other methods on the class. Note that values should have type 'Function' but TS requires
|
||||
* all properties to have a narrower type than the index signature.
|
||||
*/
|
||||
[x: string]: Type | Function | any[] | undefined;
|
||||
[x: string]: Type | Function | any[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,6 +9,7 @@ cd `dirname $0`
|
|||
source ./env.sh
|
||||
cd ../..
|
||||
|
||||
$(npm bin)/tsc -v
|
||||
$(npm bin)/tsc -p tools
|
||||
cp tools/@angular/tsc-wrapped/package.json dist/tools/@angular/tsc-wrapped
|
||||
node dist/tools/@angular/tsc-wrapped/src/main -p modules
|
||||
|
|
|
@ -23,6 +23,7 @@ echo 'travis_fold:end:test.buildPackages'
|
|||
|
||||
|
||||
./scripts/ci-lite/offline_compiler_test.sh
|
||||
./tools/typings-test/test.sh
|
||||
|
||||
echo 'travis_fold:start:test.e2e.localChrome'
|
||||
cd dist/
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
"target": "es5"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
"node_modules",
|
||||
"typings-test"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
import * as compiler from '@angular/compiler';
|
||||
import * as compiler_cli from '@angular/compiler-cli';
|
||||
import * as compilerTesting from '@angular/compiler/testing';
|
||||
import * as coreTesting from '@angular/core';
|
||||
import * as core from '@angular/core/testing';
|
||||
import * as httpTesting from '@angular/http';
|
||||
import * as http from '@angular/http/testing';
|
||||
import * as platformBrowserTesting from '@angular/platform-browser';
|
||||
import * as platformBrowserDynmic from '@angular/platform-browser-dynamic';
|
||||
import * as platformBrowser from '@angular/platform-browser/testing';
|
||||
import * as platfomrServerTesting from '@angular/platform-server';
|
||||
import * as platfomrServer from '@angular/platform-server/testing';
|
||||
import * as router from '@angular/router';
|
||||
import * as routerDeprecatedTesting from '@angular/router-deprecated';
|
||||
import * as routerDeprecated from '@angular/router-deprecated/testing';
|
||||
import * as routerTesting from '@angular/router/testing';
|
||||
import * as upgrade from '@angular/upgrade';
|
||||
|
||||
export default {
|
||||
compiler,
|
||||
compilerTesting,
|
||||
compiler_cli,
|
||||
core,
|
||||
coreTesting,
|
||||
http,
|
||||
httpTesting,
|
||||
platformBrowser,
|
||||
platformBrowserTesting,
|
||||
platformBrowserDynmic,
|
||||
platfomrServer,
|
||||
platfomrServerTesting,
|
||||
router,
|
||||
routerTesting,
|
||||
routerDeprecated,
|
||||
routerDeprecatedTesting,
|
||||
upgrade
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
set -ex -o pipefail
|
||||
|
||||
# These ones can be `npm link`ed for fast development
|
||||
LINKABLE_PKGS=(
|
||||
$(pwd)/dist/packages-dist/{common,core,compiler,compiler-cli,http,router,router-deprecated,upgrade,platform-{browser,browser-dynamic,server}}
|
||||
)
|
||||
|
||||
TMPDIR=${TMPDIR:-/tmp/angular-build/}
|
||||
readonly TMP=$TMPDIR/typings-test.$(date +%s)
|
||||
mkdir -p $TMP
|
||||
cp -R -v tools/typings-test/* $TMP
|
||||
|
||||
# run in subshell to avoid polluting cwd
|
||||
(
|
||||
cd $TMP
|
||||
# create package.json so that npm install doesn't pollute any parent node_modules's directory
|
||||
npm init --yes
|
||||
npm install ${LINKABLE_PKGS[*]}
|
||||
npm install @types/es6-promise @types/es6-collections @types/jasmine rxjs@5.0.0-beta.6
|
||||
npm install typescript@1.8.10
|
||||
$(npm bin)/tsc --version
|
||||
$(npm bin)/tsc -p tsconfig.json
|
||||
)
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../../dist/typing-test/",
|
||||
"rootDir": ".",
|
||||
"target": "es5"
|
||||
},
|
||||
"files": [
|
||||
"include-all.ts",
|
||||
"node_modules/@types/es6-promise/index.d.ts",
|
||||
"node_modules/@types/es6-collections/index.d.ts",
|
||||
"node_modules/@types/jasmine/index.d.ts"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue