UNPKG

@athenna/core

Version:

One foundation for multiple applications.

34 lines (33 loc) 1.36 kB
/** * @athenna/core * * (c) João Lenon <lenon@athenna.io> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ import { Path, Module } from '@athenna/common'; import { BaseCommand, Commander } from '@athenna/artisan'; export class TestCommand extends BaseCommand { static signature() { return 'test'; } static description() { return 'Run the tests of your application.'; } static commander(commander) { return commander .allowUnknownOption() .option('--tests', 'Specify test titles: --tests="shouldBeOk,shouldNotBeOk"') .option('--groups', 'Specify group titles: --groups="AppControllerTest,AppServiceTest"') .option('--files', 'Specify files to match and run: --files="AppControllerTest.ts,AppServiceTest.ts"') .option('--tags', 'Specify tags to match and run: --tags="unit"') .option('--force-exit', 'Enable/disable force exit') .option('--timeout', 'Define timeout for all tests: --timeout 3000'); } async handle() { const entrypoint = Config.get('rc.commands.test.entrypoint', Path.bin(`test.${Path.ext()}`)); process.argv.splice(2, 1); await Module.resolve(entrypoint, Config.get('rc.parentURL')); } }