import * as path from 'path' ; import { nls } from '../i18n' ; import { CreateUtil } from '../utils' ; import { LightningTestOptions } from '../utils/types' ; import { SfdxGenerator } from './sfdxGenerator' ; export default class LightningTestGenerator extends SfdxGenerator < LightningTestOptions > { constructor ( args , options ) { super ( args , options ) ; this . sourceRootWithPartialPath ( 'lightningtest' ) ; } public validateOptions ( ) { CreateUtil . checkInputs ( this . options . testname ) ; CreateUtil . checkInputs ( this . options . template ) ; } public writing ( ) { const { template , outputdir , testname , internal } = this . options ; if ( ! internal ) { this . fs . copyTpl ( this . templatePath ( '_staticresource.resource-meta.xml' ) , this . destinationPath ( path . join ( outputdir , `${ testname }.resource-meta.xml` ) ) , { description : nls . localize ( 'LightningTest' ) } , { apiName : testname } ) ; } this . fs . copyTpl ( this . templatePath ( `${ template }.resource` ) , this . destinationPath ( path . join ( outputdir , `${ testname }.resource` ) ) , { apiName : testname } ) ; } }