@@ -3,6 +3,12 @@ import { join } from 'path';
33import * as Paths from '../../scripts/paths' ;
44import * as fs from 'fs-extra' ;
55
6+ const TEMPLATE_EXCLUDED_ITEMS = [
7+ 'node_modules' ,
8+ 'package.json' ,
9+ 'package-lock.json' ,
10+ ] ;
11+
612class TestCaseRunDescriptor {
713 // tslint:disable-next-line:variable-name
814 protected _options : RunTestOptions ;
@@ -45,7 +51,9 @@ class TestCaseRunDescriptor {
4551 } ) ;
4652 if ( logOutputUnlessStatusIs != null ) {
4753 console . log (
48- `Output of "${ this . name } " using template "${ this . templateName } ":\n\n` ,
54+ `Output of test run in "${ this . name } " using template "${
55+ this . templateName
56+ } ":\n\n`,
4957 result . output . trim ( ) ,
5058 ) ;
5159 }
@@ -86,7 +94,7 @@ export function run(
8694
8795 const prefix =
8896 pkg . scripts && pkg . scripts . test
89- ? [ 'npm' , 'run' , 'test' ]
97+ ? [ 'npm' , '-s' , ' run', 'test' ]
9098 : [ join ( dir , 'node_modules' , '.bin' , 'jest' ) ] ;
9199 args = [ ...prefix , ...args ] ;
92100 const cmd = args . shift ( ) ;
@@ -133,5 +141,13 @@ function prepareTest(name: string, template: string): string {
133141 join ( caseDir , 'node_modules' ) ,
134142 ) ;
135143
144+ // copy all other files from the template to the case dir
145+ fs . readdirSync ( templateDir ) . forEach ( item => {
146+ if ( TEMPLATE_EXCLUDED_ITEMS . includes ( item ) ) {
147+ return ;
148+ }
149+ fs . copySync ( join ( templateDir , item ) , join ( caseDir , item ) ) ;
150+ } ) ;
151+
136152 return caseDir ;
137153}
0 commit comments