refactor: always build

This commit is contained in:
cha0s 2022-03-24 09:44:37 -05:00
parent 4ba2b51136
commit d6160c067c

View File

@ -28,18 +28,18 @@ export default (program, flecks) => {
const {
watch,
} = opts;
const {build} = coreCommands(program, flecks);
const child = build.action(undefined, opts);
const testPaths = glob.sync(join(FLECKS_CORE_ROOT, 'test/*.js'));
if (0 === testPaths.length) {
// eslint-disable-next-line no-console
console.log('No fleck tests found.');
return 0;
return child;
}
const testLocation = join(FLECKS_CORE_ROOT, 'dist', 'test.js');
if (watch) {
await unlink(testLocation);
}
const {build} = coreCommands(program, flecks);
const child = build.action(undefined, opts);
debug('Testing...', opts);
// eslint-disable-next-line no-constant-condition
while (true) {
@ -76,7 +76,8 @@ export default (program, flecks) => {
await runMocha();
return 0;
}
chokidar.watch(testLocation).on('all', async () => {
chokidar.watch(testLocation)
.on('all', async () => {
await new Promise((resolve) => setTimeout(resolve, 50));
runMocha();
});