diff --git a/src/concurrently.ts b/src/concurrently.ts index ec2f90b..430119f 100644 --- a/src/concurrently.ts +++ b/src/concurrently.ts @@ -1,9 +1,9 @@ import * as chalk from 'chalk'; +import stripAnsi from 'strip-ansi'; import { ConcurrentCommand } from './command'; import { getName } from './get-name'; import { logError } from './log-error'; import { runCommand } from './run-command'; -import { stripAnsiAndChalk } from './strip-ansi-and-chalk'; import { WaitCondition } from './wait-condition'; /** @@ -46,7 +46,7 @@ export function concurrently(commands: ConcurrentCommand[], index = 0): void { } case WaitCondition.Includes: { runCommand(command.command, index, name, command.longestName, message => { - if (!conditionMet && stripAnsiAndChalk(message).toLowerCase().includes(command.value!.toLowerCase())) { + if (!conditionMet && stripAnsi(message).trim().toLowerCase().includes(command.value!.toLowerCase())) { conditionMet = true; concurrently(commands, nextIndex); @@ -64,7 +64,7 @@ export function concurrently(commands: ConcurrentCommand[], index = 0): void { } case WaitCondition.Matches: { runCommand(command.command, index, name, command.longestName, message => { - if (!conditionMet && stripAnsiAndChalk(message) === command.value) { + if (!conditionMet && stripAnsi(message).trim() === command.value?.trim()) { conditionMet = true; concurrently(commands, nextIndex); diff --git a/src/strip-ansi-and-chalk.ts b/src/strip-ansi-and-chalk.ts deleted file mode 100644 index 34cba6d..0000000 --- a/src/strip-ansi-and-chalk.ts +++ /dev/null @@ -1,5 +0,0 @@ -import stripAnsi from 'strip-ansi'; - -export function stripAnsiAndChalk(value: string): string { - return stripAnsi(value).replace(/\u001b[^m]*?m/g, ''); -} diff --git a/src/strip-ansi.ts b/src/strip-ansi.ts deleted file mode 100644 index 1315680..0000000 --- a/src/strip-ansi.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function stripAnsi(value: string): string { - return value.replace(/\u001b[^m]*?m/g, ''); -}