nx/e2e/schematics/jest.test.ts
Jason Jean d6ff7244c7 feat(schematics): allow generation of app with jest unit testing (#764)
This PR requires https://github.com/nrwl/nx/pull/758

## Current Behavior

The option to generate an application with a unit-test-runner of jest is not available

## Expected Behavior

User is able to generate an application which uses jest to run unit tests via:
```sh
ng g jest
ng g app jest-app --unit-test-runner jest
ng test jest-app
```
2018-09-14 11:59:49 -04:00

46 lines
1.2 KiB
TypeScript

import {
newProject,
runCLI,
newLib,
runCLIAsync,
newApp,
copyMissingPackages
} from '../utils';
describe('Jest', () => {
beforeAll(() => {
newProject();
runCLI('generate jest');
copyMissingPackages();
});
it(
'should be able to generate a testable library using jest',
async done => {
newLib('jestlib --unit-test-runner jest');
await Promise.all([
runCLIAsync('generate service test --project jestlib'),
runCLIAsync('generate component test --project jestlib')
]);
const jestResult = await runCLIAsync('test jestlib');
expect(jestResult.stderr).toContain('Test Suites: 3 passed, 3 total');
done();
},
10000
);
it(
'should be able to generate a testable application using jest',
async () => {
newApp('jestapp --unit-test-runner jest');
await Promise.all([
runCLIAsync('generate service test --project jestapp'),
runCLIAsync('generate component test --project jestapp')
]);
const jestResult = await runCLIAsync('test jestapp');
expect(jestResult.stderr).toContain('Test Suites: 3 passed, 3 total');
},
10000
);
});