File tree Expand file tree Collapse file tree 4 files changed +24
-34
lines changed Expand file tree Collapse file tree 4 files changed +24
-34
lines changed Original file line number Diff line number Diff line change 1- const ng : ( ( parameters : string [ ] ) => Promise < any > ) = require ( './ng' ) ;
2- const tmp = require ( './tmp' ) ;
1+ import { ng } from './ng' ;
2+ import { setup , teardown } from './tmp' ;
3+
4+ export { ng } ;
35
46export function setupProject ( ) {
57 beforeEach ( ( done ) => {
68 spyOn ( console , 'error' ) ;
79
8- tmp . setup ( './tmp' )
10+ setup ( './tmp' )
911 . then ( ( ) => process . chdir ( './tmp' ) )
1012 . then ( ( ) => ng ( [ 'new' , 'foo' , '--skip-install' ] ) )
1113 . then ( done , done . fail ) ;
1214 } , 10000 ) ;
1315
1416 afterEach ( ( done ) => {
15- tmp . teardown ( './tmp' ) . then ( done , done . fail ) ;
17+ teardown ( './tmp' ) . then ( done , done . fail ) ;
1618 } ) ;
1719}
18-
19- export {
20- ng
21- } ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- 'use strict' ;
2-
1+ import cli from '@angular/cli/lib/cli' ;
32const UI = require ( '@angular/cli/ember-cli/lib/ui' ) ;
43const through = require ( 'through' ) ;
54
6- module . exports = MockUI ;
75function MockUI ( ) {
86 this . output = '' ;
97
108 UI . call ( this , {
119 inputStream : through ( ) ,
12- outputStream : through ( function ( data ) {
10+ outputStream : through ( function ( data : any ) {
1311 this . output += data ;
1412 } . bind ( this ) ) ,
15- errorStream : through ( function ( data ) {
13+ errorStream : through ( function ( data : any ) {
1614 this . errors += data ;
1715 } . bind ( this ) )
1816 } ) ;
@@ -23,3 +21,15 @@ MockUI.prototype.constructor = MockUI;
2321MockUI . prototype . clear = function ( ) {
2422 this . output = '' ;
2523} ;
24+
25+ export function ng ( args : any ) {
26+ process . env . PWD = process . cwd ( ) ;
27+
28+ return cli ( {
29+ inputStream : [ ] ,
30+ outputStream : [ ] ,
31+ cliArgs : args ,
32+ UI : MockUI ,
33+ testing : true
34+ } ) ;
35+ }
Original file line number Diff line number Diff line change 1- 'use strict' ;
2-
3- const fs = require ( 'fs-extra' ) ;
1+ import * as fs from 'fs-extra' ;
42
53const root = process . cwd ( ) ;
64
7- module . exports . setup = function ( path ) {
5+ export function setup ( path : string ) {
86 process . chdir ( root ) ;
97
108 return fs . remove ( path ) . then ( function ( ) {
119 fs . mkdirsSync ( path ) ;
1210 } ) ;
1311} ;
1412
15- module . exports . teardown = function ( path ) {
13+ export function teardown ( path : string ) {
1614 process . chdir ( root ) ;
1715
1816 if ( fs . pathExistsSync ( path ) ) {
You can’t perform that action at this time.
0 commit comments