@@ -33,6 +33,7 @@ temp.track();
3333
3434let assert = require ( "chai" ) . assert ;
3535let nodeModulesFolderName = "node_modules" ;
36+ let packageJsonName = "package.json" ;
3637
3738function createTestInjector ( ) : IInjector {
3839 let testInjector = new yok . Yok ( ) ;
@@ -110,10 +111,10 @@ function createProject(testInjector: IInjector, dependencies?: any): string {
110111 return tempFolder ;
111112}
112113
113- function setupProject ( ) : IFuture < any > {
114+ function setupProject ( dependencies ?: any ) : IFuture < any > {
114115 return ( ( ) => {
115116 let testInjector = createTestInjector ( ) ;
116- let projectFolder = createProject ( testInjector ) ;
117+ let projectFolder = createProject ( testInjector , dependencies ) ;
117118
118119 let fs = testInjector . resolve ( "fs" ) ;
119120
@@ -278,7 +279,7 @@ describe("Npm support tests", () => {
278279
279280describe ( "Flatten npm modules tests" , ( ) => {
280281 it ( "Doesn't handle the dependencies of devDependencies" , ( ) => {
281- let projectSetup = setupProject ( ) . wait ( ) ;
282+ let projectSetup = setupProject ( { } ) . wait ( ) ;
282283 let testInjector = projectSetup . testInjector ;
283284 let projectFolder = projectSetup . projectFolder ;
284285 let appDestinationFolderPath = projectSetup . appDestinationFolderPath ;
@@ -297,9 +298,6 @@ describe("Flatten npm modules tests", () => {
297298 let fs = testInjector . resolve ( "fs" ) ;
298299 let tnsModulesFolderPath = path . join ( appDestinationFolderPath , "app" , "tns_modules" ) ;
299300
300- let lodashFolderPath = path . join ( tnsModulesFolderPath , "lodash" ) ;
301- assert . isTrue ( fs . exists ( lodashFolderPath ) . wait ( ) ) ;
302-
303301 let gulpFolderPath = path . join ( tnsModulesFolderPath , "gulp" ) ;
304302 assert . isFalse ( fs . exists ( gulpFolderPath ) . wait ( ) ) ;
305303
@@ -310,20 +308,20 @@ describe("Flatten npm modules tests", () => {
310308 assert . isFalse ( fs . exists ( gulpJshint ) . wait ( ) ) ;
311309
312310 // Get all gulp dependencies
313- let gulpDependencies = fs . readDirectory ( path . join ( projectFolder , nodeModulesFolderName , "gulp" , nodeModulesFolderName ) ) . wait ( ) ;
314- _ . each ( gulpDependencies , dependency => {
311+ let gulpJsonContent = fs . readJson ( path . join ( projectFolder , nodeModulesFolderName , "gulp" , packageJsonName ) ) . wait ( ) ;
312+ _ . each ( _ . keys ( gulpJsonContent . dependencies ) , dependency => {
315313 assert . isFalse ( fs . exists ( path . join ( tnsModulesFolderPath , dependency ) ) . wait ( ) ) ;
316314 } ) ;
317315
318316 // Get all gulp-jscs dependencies
319- let gulpJscsDependencies = fs . readDirectory ( path . join ( projectFolder , nodeModulesFolderName , "gulp-jscs" , nodeModulesFolderName ) ) . wait ( ) ;
320- _ . each ( gulpJscsDependencies , dependency => {
317+ let gulpJscsJsonContent = fs . readJson ( path . join ( projectFolder , nodeModulesFolderName , "gulp-jscs" , packageJsonName ) ) . wait ( ) ;
318+ _ . each ( _ . keys ( gulpJscsJsonContent . dependencies ) , dependency => {
321319 assert . isFalse ( fs . exists ( path . join ( tnsModulesFolderPath , dependency ) ) . wait ( ) ) ;
322320 } ) ;
323321
324322 // Get all gulp-jshint dependencies
325- let gulpJshintDependencies = fs . readDirectory ( path . join ( projectFolder , nodeModulesFolderName , "gulp-jshint" , nodeModulesFolderName ) ) . wait ( ) ;
326- _ . each ( gulpJshintDependencies , dependency => {
323+ let gulpJshintJsonContent = fs . readJson ( path . join ( projectFolder , nodeModulesFolderName , "gulp-jshint" , packageJsonName ) ) . wait ( ) ;
324+ _ . each ( _ . keys ( gulpJshintJsonContent . dependencies ) , dependency => {
327325 assert . isFalse ( fs . exists ( path . join ( tnsModulesFolderPath , dependency ) ) . wait ( ) ) ;
328326 } ) ;
329327 } ) ;
0 commit comments