Remove the deprecated function `getJestProjects`. BREAKING CHANGE: The previously deprecated `getJestProjects` function was removed in favor of `getJestProjectsAsync`.
46 lines
1.0 KiB
TypeScript
46 lines
1.0 KiB
TypeScript
import { createTree } from '@nx/devkit/testing';
|
|
import { jestConfigObject, jestConfigObjectAst } from './functions';
|
|
|
|
describe('jestConfigObject', () => {
|
|
describe('module.exports', () => {
|
|
it('should work for basic cases', () => {
|
|
const tree = createTree();
|
|
tree.write(
|
|
'jest.config.js',
|
|
`
|
|
module.exports = {
|
|
foo: 'bar'
|
|
};
|
|
`
|
|
);
|
|
|
|
expect(jestConfigObject(tree, 'jest.config.js')).toEqual({
|
|
foo: 'bar',
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('export default', () => {
|
|
it('should work for basic cases', () => {
|
|
const content = `
|
|
export default {
|
|
abc: 'xyz'
|
|
}`;
|
|
|
|
expect(jestConfigObjectAst(content).getText()).toMatchSnapshot();
|
|
});
|
|
|
|
it('should handle spread assignments', () => {
|
|
const content = `
|
|
import { nxPreset } from '@nx/jest/preset';
|
|
|
|
export default {
|
|
...nxPreset,
|
|
abc: 'xyz'
|
|
}`;
|
|
|
|
expect(jestConfigObjectAst(content).getText()).toMatchSnapshot();
|
|
});
|
|
});
|
|
});
|