11// @ts -check
22import { CancelToken } from "@esfx/canceltoken" ;
33import assert from "assert" ;
4- import chalk from "chalk" ;
54import chokidar from "chokidar" ;
65import esbuild from "esbuild" ;
76import { EventEmitter } from "events" ;
87import fs from "fs" ;
98import { glob } from "glob" ;
109import { task } from "hereby" ;
1110import path from "path" ;
11+ import pc from "picocolors" ;
1212
1313import { localizationDirectories } from "./scripts/build/localization.mjs" ;
1414import cmdLineOptions from "./scripts/build/options.mjs" ;
@@ -399,7 +399,7 @@ function entrypointBuildTask(options) {
399399 // allowing them to operate as regular tasks, while creating unresolved promises
400400 // in the background that keep the process running after all tasks have exited.
401401 if ( ! printedWatchWarning ) {
402- console . error ( chalk . yellowBright ( "Warning: watch mode is incomplete and may not work as expected. Use at your own risk." ) ) ;
402+ console . error ( pc . yellowBright ( "Warning: watch mode is incomplete and may not work as expected. Use at your own risk." ) ) ;
403403 printedWatchWarning = true ;
404404 }
405405
@@ -707,7 +707,7 @@ export const runTestsAndWatch = task({
707707 dependencies : [ watchTests ] ,
708708 run : async ( ) => {
709709 if ( ! cmdLineOptions . tests && ! cmdLineOptions . failed ) {
710- console . log ( chalk . redBright ( `You must specifiy either --tests/-t or --failed to use 'runtests-watch'.` ) ) ;
710+ console . log ( pc . redBright ( `You must specifiy either --tests/-t or --failed to use 'runtests-watch'.` ) ) ;
711711 return ;
712712 }
713713
@@ -719,9 +719,8 @@ export const runTestsAndWatch = task({
719719
720720 const testsChangedDebouncer = new Debouncer ( 1_000 , endRunTests ) ;
721721 const testCaseWatcher = chokidar . watch ( [
722- "tests/cases/**/*.*" ,
723- "tests/lib/**/*.*" ,
724- "tests/projects/**/*.*" ,
722+ "tests/cases" ,
723+ "tests/lib" ,
725724 ] , {
726725 ignorePermissionErrors : true ,
727726 alwaysStat : true ,
@@ -746,7 +745,7 @@ export const runTestsAndWatch = task({
746745 running = false ;
747746 }
748747 if ( watching ) {
749- console . log ( chalk . yellowBright ( `[watch] test run complete, waiting for changes...` ) ) ;
748+ console . log ( pc . yellowBright ( `[watch] test run complete, waiting for changes...` ) ) ;
750749 await promise ;
751750 }
752751 }
@@ -756,7 +755,7 @@ export const runTestsAndWatch = task({
756755 }
757756
758757 /**
759- * @param {'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir' } eventName
758+ * @param {'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir' | 'all' | 'ready' | 'raw' | 'error' } eventName
760759 * @param {string } path
761760 * @param {fs.Stats | undefined } stats
762761 */
@@ -783,9 +782,9 @@ export const runTestsAndWatch = task({
783782 */
784783 function beginRunTests ( path ) {
785784 if ( testsChangedDebouncer . empty ) {
786- console . log ( chalk . yellowBright ( `[watch] tests changed due to '${ path } ', restarting...` ) ) ;
785+ console . log ( pc . yellowBright ( `[watch] tests changed due to '${ path } ', restarting...` ) ) ;
787786 if ( running ) {
788- console . log ( chalk . yellowBright ( "[watch] aborting in-progress test run..." ) ) ;
787+ console . log ( pc . yellowBright ( "[watch] aborting in-progress test run..." ) ) ;
789788 }
790789 testsChangedCancelSource . cancel ( ) ;
791790 testsChangedCancelSource = CancelToken . source ( ) ;
@@ -803,7 +802,7 @@ export const runTestsAndWatch = task({
803802 function endWatchMode ( ) {
804803 if ( watching ) {
805804 watching = false ;
806- console . log ( chalk . yellowBright ( "[watch] exiting watch mode..." ) ) ;
805+ console . log ( pc . yellowBright ( "[watch] exiting watch mode..." ) ) ;
807806 testsChangedCancelSource . cancel ( ) ;
808807 testCaseWatcher . close ( ) ;
809808 watchTestsEmitter . off ( "rebuild" , onRebuild ) ;
0 commit comments