Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test/jest/unit/lib/iac/drift/drift.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as mockFs from 'mock-fs';
import chalk from 'chalk';

import {
driftignoreFromPolicy,
Expand Down Expand Up @@ -396,6 +397,22 @@ describe('Test describe output', () => {
return fs.readFileSync(filePath, 'utf-8');
};

// The .console fixtures contain ANSI colour codes, so the output has to be
// generated with colour on. Chalk otherwise decides that from the ambient
// environment and emits plain text whenever stdout is not a TTY.
const originalLevel = chalk.level;
const originalEnabled = chalk.enabled;

beforeAll(() => {

@PeterSchafer PeterSchafer Aug 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: has this been an issue you experienced somehwere? Otherwise such a global state change will become a problem when we start parallelizing things. Maybe NO_COLOR=1 for the CLI subprocess makes more sense!

chalk.level = 1;
chalk.enabled = true;
});

afterAll(() => {
chalk.level = originalLevel;
chalk.enabled = originalEnabled;
});

it('test output for known analysis', () => {
const analysis = JSON.parse(loadFile('all.json'));
const options: DescribeOptions = {
Expand Down