From 8c8754e57378f23482d2eeef87674438a0ae62e3 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 29 Jul 2016 14:10:20 -0700 Subject: [PATCH] chore: add browserNoRouter test running mode --- DEVELOPER.md | 7 ++-- .../@angular/core/src/application_module.ts | 3 -- test.sh | 2 +- tools/tsc-watch/index.ts | 39 ++++++++++++------- 4 files changed, 29 insertions(+), 22 deletions(-) diff --git a/DEVELOPER.md b/DEVELOPER.md index 9b1633c8b4..81058113cd 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -101,11 +101,12 @@ To build Angular run: To run tests: ```shell -$ ./test.sh node +$ ./test.sh node # Run all angular tests on node -$ ./test.sh browser +$ ./test.sh browser # Run all angular tests in browser +$ ./test.sh browserNoRouter # Optionally run all angular tests without router in browser -$ ./test.sh tools +$ ./test.sh tools # Run angular tooling (not framework) tests ``` You should execute the 3 test suites before submitting a PR to github. diff --git a/modules/@angular/core/src/application_module.ts b/modules/@angular/core/src/application_module.ts index 95347712ce..e75befa4fe 100644 --- a/modules/@angular/core/src/application_module.ts +++ b/modules/@angular/core/src/application_module.ts @@ -13,14 +13,11 @@ import {APP_ID_RANDOM_PROVIDER} from './application_tokens'; import {IterableDiffers, KeyValueDiffers, defaultIterableDiffers, defaultKeyValueDiffers} from './change_detection/change_detection'; import {OptionalMetadata, SkipSelfMetadata} from './di'; import {Compiler} from './linker/compiler'; -import {ComponentFactoryResolver} from './linker/component_factory_resolver'; import {ComponentResolver} from './linker/component_resolver'; import {DynamicComponentLoader, DynamicComponentLoader_} from './linker/dynamic_component_loader'; import {ViewUtils} from './linker/view_utils'; import {NgModule} from './metadata'; -let __unused: Type; // avoid unused import when Type union types are erased - export function _iterableDiffersFactory() { return defaultIterableDiffers; } diff --git a/test.sh b/test.sh index 741a01342d..b3ea5d628b 100755 --- a/test.sh +++ b/test.sh @@ -6,7 +6,7 @@ if [ $# -eq 0 ] then echo "Angular test runner. (No platform specified)" echo - echo "./test.sh [node|browser|tools]" + echo "./test.sh [node|browser|browserNoRouter|tools]" echo else cd `dirname $0` diff --git a/tools/tsc-watch/index.ts b/tools/tsc-watch/index.ts index dda662c06f..558bd45ad6 100644 --- a/tools/tsc-watch/index.ts +++ b/tools/tsc-watch/index.ts @@ -58,13 +58,15 @@ function md(dir: string, folders: string[]) { var tscWatch: TscWatch = null; var platform = process.argv.length >= 3 ? process.argv[2] : null; var runMode: string = process.argv.length >= 4 ? process.argv[3] : null; +const BaseConfig = { + start: 'File change detected. Starting incremental compilation...', + error: 'error', + complete: 'Compilation complete. Watching for file changes.' +}; if (platform == 'node') { - tscWatch = new TscWatch({ + tscWatch = new TscWatch(Object.assign({ tsconfig: 'modules/tsconfig.json', - start: 'File change detected. Starting incremental compilation...', - error: 'error', - complete: 'Compilation complete. Watching for file changes.', onChangeCmds: [ processOutputEmitterCodeGen, [ @@ -72,13 +74,10 @@ if (platform == 'node') { '@angular/compiler-cli/test/**/*_spec.js' ] ] - }); + }, BaseConfig)); } else if (platform == 'browser') { - tscWatch = new TscWatch({ + tscWatch = new TscWatch(Object.assign({ tsconfig: 'modules/tsconfig.json', - start: 'File change detected. Starting incremental compilation...', - error: 'error', - complete: 'Compilation complete. Watching for file changes.', onStartCmds: [ [ 'node', 'node_modules/karma/bin/karma', 'start', '--no-auto-watch', '--port=9876', @@ -93,17 +92,27 @@ if (platform == 'node') { ['node', 'node_modules/karma/bin/karma', 'run', 'karma-js.conf.js', '--port=9876'], ['node', 'node_modules/karma/bin/karma', 'run', '--port=9877'], ] - }); + }, BaseConfig)); +} else if (platform == 'browserNoRouter') { + tscWatch = new TscWatch(Object.assign({ + tsconfig: 'modules/tsconfig.json', + onStartCmds: [ + [ + 'node', 'node_modules/karma/bin/karma', 'start', '--no-auto-watch', '--port=9876', + 'karma-js.conf.js' + ] + ], + onChangeCmds: [ + ['node', 'node_modules/karma/bin/karma', 'run', 'karma-js.conf.js', '--port=9876'], + ] + }, BaseConfig)); } else if (platform == 'tools') { - tscWatch = new TscWatch({ + tscWatch = new TscWatch(Object.assign({ tsconfig: 'tools/tsconfig.json', - start: 'File change detected. Starting incremental compilation...', - error: 'error', - complete: 'Compilation complete. Watching for file changes.', onChangeCmds: [[ 'node', 'dist/tools/cjs-jasmine/index-tools', '--', '@angular/tsc-wrapped/**/*{_,.}spec.js' ]] - }); + }, BaseConfig)); } else { throw new Error(`unknown platform: ${platform}`); }