1
1
'use strict' ;
2
2
3
- const fs = require ( 'fs' ) ;
3
+ const fs = require ( 'fs-extra ' ) ;
4
4
const path = require ( 'path' ) ;
5
5
const helpers = require ( 'ember-cli-blueprint-test-helpers/helpers' ) ;
6
6
const chaiHelpers = require ( 'ember-cli-blueprint-test-helpers/chai' ) ;
7
+ const Blueprint = require ( 'ember-cli/lib/models/blueprint' ) ;
7
8
8
9
const ects = require ( '../../blueprints/ember-cli-typescript' ) ;
9
10
@@ -13,6 +14,31 @@ const file = chaiHelpers.file;
13
14
describe ( 'Acceptance: ember-cli-typescript generator' , function ( ) {
14
15
helpers . setupTestHooks ( this , { disabledTasks : [ 'addon-install' , 'bower-install' ] } ) ;
15
16
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
+
16
42
it ( 'basic app' , function ( ) {
17
43
const args = [ 'ember-cli-typescript' ] ;
18
44
0 commit comments