fix(schematics): do not add setup file for --no-module libs

This commit is contained in:
--get 2018-10-23 15:03:50 -04:00 committed by Victor Savkin
parent 47d99d49ba
commit 31061d42b6
2 changed files with 11 additions and 1 deletions

View File

@ -444,7 +444,8 @@ export default function(schema: Schema): Rule {
updateTsConfig(options),
options.unitTestRunner === 'jest'
? schematic('jest-project', {
project: options.name
project: options.name,
skipSetupFile: !options.module
})
: noop(),

View File

@ -435,6 +435,15 @@ describe('lib', () => {
'libs/my-lib/tsconfig.spec.json'
]);
});
it('should skip the setup file if no module is generated', () => {
const resultTree = schematicRunner.runSchematic(
'lib',
{ name: 'myLib', unitTestRunner: 'jest', module: false },
appTree
);
expect(resultTree.exists('libs/my-lib/src/test-setup.ts')).toBeFalsy();
});
});
describe('--unit-test-runner none', () => {