Skip to content
Open
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(() => {
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