Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add typescript test for our typings #9096

Merged
merged 2 commits into from Jun 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/@angular/core/src/util/decorators.ts
Expand Up @@ -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[];
}

/**
Expand Down
1 change: 1 addition & 0 deletions scripts/ci-lite/build.sh
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions scripts/ci-lite/test_e2e.sh
Expand Up @@ -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/
Expand Down
3 changes: 2 additions & 1 deletion tools/tsconfig.json
Expand Up @@ -17,6 +17,7 @@
"target": "es5"
},
"exclude": [
"node_modules"
"node_modules",
"typings-test"
]
}
37 changes: 37 additions & 0 deletions tools/typings-test/include-all.ts
@@ -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
}
24 changes: 24 additions & 0 deletions tools/typings-test/test.sh
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -ex -o pipefail

# These ones can be `npm link`ed for fast development
LINKABLE_PKGS=(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this copy-paste is sad and slow - my intent was that we do one e2e test fixture setup, where we install the npm packages to a tmpdir, then we could run all the e2e tests, including typechecking, offline compilation, etc in that place.
What do you think?
(to be clear, I don't have time to make the change right now but would put it on a someday-good-intentions list)

$(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
)
17 changes: 17 additions & 0 deletions tools/typings-test/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"
]
}