@@ -50,13 +50,22 @@ export function entry(file: string) {
5050export function query ( q : any ) {
5151 return config => {
5252 _ . merge (
53- config . module . loaders . find ( loader =>
54- loader . loader === LOADER ) . query ,
53+ config . module . loaders . find ( loader => loader . loader === LOADER ) . query ,
5554 q
5655 ) ;
5756 } ;
5857}
5958
59+ export function include ( ...folders : string [ ] ) {
60+ return config => {
61+ config . module . loaders . find ( loader => loader . loader === LOADER ) . include . push (
62+ ...folders . map ( f => {
63+ return path . join ( process . cwd ( ) , f ) ;
64+ } )
65+ ) ;
66+ } ;
67+ }
68+
6069export function webpackConfig ( ...enchance : any [ ] ) : webpack . Configuration {
6170 const config = {
6271 entry : { index : path . join ( process . cwd ( ) , SRC_DIR , 'index.ts' ) } ,
@@ -288,6 +297,10 @@ export function touchFile(fileName: string): Promise<any> {
288297 . then ( source => writeFile ( fileName , source ) ) ;
289298}
290299
300+ export function moveFile ( from : string , to : string ) {
301+ fs . renameSync ( from , to ) ;
302+ }
303+
291304export function compile ( config ) : Promise < any > {
292305 return new Promise ( ( resolve , reject ) => {
293306 const compiler = webpack ( config ) ;
@@ -436,6 +449,12 @@ export class Fixture {
436449 touchFile ( this . fileName ) ;
437450 }
438451
452+ move ( to : string ) {
453+ mkdirp . sync ( path . dirname ( to ) ) ;
454+ moveFile ( this . fileName , to ) ;
455+ this . fileName = to ;
456+ }
457+
439458 update ( updater : ( text : string ) => string ) {
440459 let newText = updater ( this . text ) ;
441460 this . text = newText ;
0 commit comments