import { isTestEnv } from './env' ; import throwError from './throwError' ; /**
 * test only
 *
 * decorator testOnly
 */ const testOnly = ( target , propertyKey , descriptor ) => { const replacer = ( origin ) => function ( ... args ) { if ( ! isTestEnv ( ) ) { throwError ( `cannot use testOnly api (${ propertyKey }) without test env` ) ; } return origin . apply ( this , args ) ; } ; descriptor . value = replacer ( descriptor . value ) ; return descriptor ; } ; export default testOnly ;