11'use strict' ;
22
3- const fs = require ( 'fs' ) ;
3+ const fs = require ( 'fs-extra ' ) ;
44const path = require ( 'path' ) ;
55const helpers = require ( 'ember-cli-blueprint-test-helpers/helpers' ) ;
66const chaiHelpers = require ( 'ember-cli-blueprint-test-helpers/chai' ) ;
7+ const Blueprint = require ( 'ember-cli/lib/models/blueprint' ) ;
78
89const ects = require ( '../../blueprints/ember-cli-typescript' ) ;
910
@@ -13,6 +14,31 @@ const file = chaiHelpers.file;
1314describe ( 'Acceptance: ember-cli-typescript generator' , function ( ) {
1415 helpers . setupTestHooks ( this , { disabledTasks : [ 'addon-install' , 'bower-install' ] } ) ;
1516
17+ const originalTaskForFn = Blueprint . prototype . taskFor ;
18+
19+ beforeEach ( function ( ) {
20+ Blueprint . prototype . taskFor = function ( taskName ) {
21+ if ( taskName === 'npm-install' ) {
22+ // Mock npm-install that only modifies package.json
23+ return {
24+ run : function ( options ) {
25+ let pkgJson = fs . readJsonSync ( 'package.json' )
26+ options . packages . forEach ( function ( pkg ) {
27+ let pkgName = pkg . match ( / ^ ( .* ) @ [ ^ @ ] * $ / ) ;
28+ pkgJson [ 'devDependencies' ] [ pkgName [ 1 ] ] = '*' ;
29+ } ) ;
30+ fs . writeJsonSync ( 'package.json' , pkgJson ) ;
31+ }
32+ }
33+ }
34+ return originalTaskForFn . call ( this , taskName ) ;
35+ } ;
36+ } ) ;
37+
38+ afterEach ( function ( ) {
39+ Blueprint . prototype . taskFor = originalTaskForFn ;
40+ } ) ;
41+
1642 it ( 'basic app' , function ( ) {
1743 const args = [ 'ember-cli-typescript' ] ;
1844
0 commit comments