import chai from 'chai'; import chaiAsPromised from 'chai-as-promised'; import chaiSubset = require('chai-subset'); chai.use(chaiAsPromised); chai.use(chaiSubset); export const { expect } = chai; // Strip ANSI escape sequences so chalk-formatted assertions are stable across // TTY (`npm test` from a terminal, where chalk emits colors) and non-TTY (CI, // where chalk auto-disables) runs. Without this, an assertion like // `.contains('"foo" — alterationHooks ×2')` fails in TTY because chalk inserts // .. around the `"foo"` token. // eslint-disable-next-line no-control-regex const ansiRegex = /\u001B\[[0-9;]*m/g; export const stripAnsi = (text: string): string => text.replaceAll(ansiRegex, '');