@@ -446,7 +446,7 @@ function runKarma(configFile, done) {
446446
447447gulp . task ( 'test.js' , function ( done ) {
448448 runSequence ( 'test.unit.tools/ci' , 'test.transpiler.unittest' , 'test.unit.js/ci' ,
449- 'test.unit.cjs/ci' , 'test.typings' , sequenceComplete ( done ) ) ;
449+ 'test.unit.cjs/ci' , 'test.typings' , 'test.typings.npm' , sequenceComplete ( done ) ) ;
450450} ) ;
451451
452452gulp . task ( 'test.dart' , function ( done ) {
@@ -771,8 +771,25 @@ gulp.task('!pre.test.typings', ['docs/typings'], function() {
771771} ) ;
772772
773773// -----------------
774+ // Tests for the typings we deliver for TS users
775+ //
776+ // There are currently two mechanisms for this.
777+ // The first is the legacy, bundled .d.ts file produced by dgeni.
778+ // This is tested by 'test.typings'.
779+ //
780+ // The second is individual .d.ts files produced by the compiler,
781+ // distributed in our npm package, and loaded from node_modules by
782+ // the typescript compiler.
783+ // This is tested by 'test.typings.npm'.
784+ //
785+ // During the transition, we support both packaging/delivery types.
786+ // TODO(alexeagle): remove the dgeni bundle when users have switched
787+
774788gulp . task ( 'test.typings' , [ '!pre.test.typings' ] , function ( ) {
775- return gulp . src ( [ 'typing_spec/*.ts' , 'dist/docs/typings/angular2/*.d.ts' , 'dist/docs/typings/http.d.ts' ] )
789+ return gulp . src ( [ 'typing_spec/*.ts' , 'dist/docs/typings/angular2/*.d.ts' ,
790+ 'dist/docs/typings/http.d.ts' ,
791+ 'dist/docs/typings/es6-shim/es6-shim.d.ts' ,
792+ 'dist/docs/typings/jasmine/jasmine.d.ts' ] )
776793 . pipe ( tsc ( { target : 'ES5' , module : 'commonjs' ,
777794 experimentalDecorators : true ,
778795 noImplicitAny : true ,
@@ -781,6 +798,29 @@ gulp.task('test.typings', ['!pre.test.typings'], function() {
781798 typescript : require ( 'typescript' ) } ) ) ;
782799} ) ;
783800
801+ // Make sure the two typings tests are isolated, by running this one in a tempdir
802+ var tmpdir = path . join ( os . tmpdir ( ) , 'test.typings' , new Date ( ) . getTime ( ) . toString ( ) ) ;
803+ gulp . task ( '!pre.test.typings.layoutNodeModule' , function ( ) {
804+ return gulp
805+ . src ( [ 'dist/js/dev/es5/angular2/**/*' ] , { base : 'dist/js/dev/es5' } )
806+ . pipe ( gulp . dest ( path . join ( tmpdir , 'node_modules' ) ) ) ;
807+ } ) ;
808+ gulp . task ( '!pre.test.typings.copyTypingsSpec' , function ( ) {
809+ return gulp
810+ . src ( [ 'typing_spec/basic_spec.ts' ] , { base : 'typing_spec' } )
811+ . pipe ( gulp . dest ( path . join ( tmpdir ) ) ) ;
812+ } ) ;
813+ gulp . task ( 'test.typings.npm' , [
814+ '!pre.test.typings.layoutNodeModule' ,
815+ '!pre.test.typings.copyTypingsSpec'
816+ ] , function ( ) {
817+ return gulp . src ( [ tmpdir + '/**' ] )
818+ . pipe ( tsc ( { target : 'ES5' , module : 'commonjs' ,
819+ experimentalDecorators : true ,
820+ noImplicitAny : true ,
821+ typescript : require ( 'typescript' ) } ) ) ;
822+ } ) ;
823+
784824// -----------------
785825// orchestrated targets
786826
0 commit comments