nx/packages/gatsby/src/generators/application/lib/update-jest-config.ts
Phillip Barta 52e3083a19
feat(core): added encoding param in Tree.read() (#5668)
feat(core): added encoding param in Tree.read()
2021-05-17 21:03:04 -04:00

15 lines
521 B
TypeScript

import { NormalizedSchema } from './normalize-options';
import { Tree } from '@nrwl/devkit';
import { updateJestConfigContent } from '@nrwl/react/src/utils/jest-utils';
export function updateJestConfig(host: Tree, options: NormalizedSchema) {
if (options.unitTestRunner !== 'jest') {
return;
}
const configPath = `${options.projectRoot}/jest.config.js`;
const originalContent = host.read(configPath, 'utf-8');
const content = updateJestConfigContent(originalContent);
host.write(configPath, content);
}