5

I just noticed on a project I'm working on that the snapshot output is not piping through colours to the terminal. The Jest framework in general does have colours. So I'm pretty confused:

enter image description here

What it should look like

This is the list of relevant packages:

"babel-jest": "^21.0.2",
"enzyme": "^3.1.0",
"enzyme-adapter-react-16": "^1.0.1",
"enzyme-to-json": "^3.3.1",

And here is the jest.config.js

module.exports = {
  setupTestFrameworkScriptFile: './setupTestFramework',
  verbose: true,
  snapshotSerializers: ['enzyme-to-json/serializer'],
  coverageReporters: [
    'lcov',
  ],
  collectCoverageFrom: [
    'src/**/*.{js,jsx}',
    'stories/**/*.{js,jsx}',
    '!**/node_modules/**',
    '!**/vendor/**',
  ],
  coverageDirectory: './',
};

And the setupTestFramework file:

import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import 'intersection-observer';

configure({ adapter: new Adapter() });

Any ideas would be greatly appreciated.

UPDATE: works with single file

Outputs colour snapshots:

yarn test <filepath>

Does NOT output colour snapshots:

yarn test

(My yarn test command is NODE_PATH=\"./src\" jest --colors)

Ashley Coolman
  • 11,095
  • 5
  • 59
  • 81

0 Answers0