@@ -40,6 +40,26 @@ describe('lib', () => {
40
40
expect ( ngPackage . dest ) . toEqual ( '../../dist/libs/my-lib' ) ;
41
41
} ) ;
42
42
43
+ it ( 'should not update package.json by default' , ( ) => {
44
+ const tree = schematicRunner . runSchematic (
45
+ 'lib' ,
46
+ { name : 'myLib' } ,
47
+ appTree
48
+ ) ;
49
+ const packageJson = readJsonInTree ( tree , '/package.json' ) ;
50
+ expect ( packageJson . devDependencies ) . toBeUndefined ( ) ;
51
+ } ) ;
52
+
53
+ it ( 'should update package.json when publishable' , ( ) => {
54
+ const tree = schematicRunner . runSchematic (
55
+ 'lib' ,
56
+ { name : 'myLib' , publishable : true } ,
57
+ appTree
58
+ ) ;
59
+ const packageJson = readJsonInTree ( tree , '/package.json' ) ;
60
+ expect ( packageJson . devDependencies [ 'ng-packagr' ] ) . toBeDefined ( ) ;
61
+ } ) ;
62
+
43
63
it ( 'should update angular.json' , ( ) => {
44
64
const tree = schematicRunner . runSchematic (
45
65
'lib' ,
@@ -102,6 +122,17 @@ describe('lib', () => {
102
122
expect ( tree . exists ( `libs/my-lib/karma.conf.js` ) ) . toBeTruthy ( ) ;
103
123
expect ( tree . exists ( 'libs/my-lib/src/index.ts' ) ) . toBeTruthy ( ) ;
104
124
expect ( tree . exists ( 'libs/my-lib/src/lib/my-lib.module.ts' ) ) . toBeTruthy ( ) ;
125
+
126
+ expect (
127
+ tree . exists ( 'libs/my-lib/src/lib/my-lib.component.ts' )
128
+ ) . toBeFalsy ( ) ;
129
+ expect (
130
+ tree . exists ( 'libs/my-lib/src/lib/my-lib.component.spec.ts' )
131
+ ) . toBeFalsy ( ) ;
132
+ expect ( tree . exists ( 'libs/my-lib/src/lib/my-lib.service.ts' ) ) . toBeFalsy ( ) ;
133
+ expect (
134
+ tree . exists ( 'libs/my-lib/src/lib/my-lib.service.spec.ts' )
135
+ ) . toBeFalsy ( ) ;
105
136
} ) ;
106
137
107
138
it ( 'should default the prefix to npmScope' , ( ) => {
@@ -140,6 +171,19 @@ describe('lib', () => {
140
171
expect (
141
172
tree . exists ( 'libs/my-dir/my-lib/src/lib/my-dir-my-lib.module.ts' )
142
173
) . toBeTruthy ( ) ;
174
+
175
+ expect (
176
+ tree . exists ( 'libs/my-dir/my-lib/src/lib/my-lib.component.ts' )
177
+ ) . toBeFalsy ( ) ;
178
+ expect (
179
+ tree . exists ( 'libs/my-dir/my-lib/src/lib/my-lib.component.spec.ts' )
180
+ ) . toBeFalsy ( ) ;
181
+ expect (
182
+ tree . exists ( 'libs/my-dir/my-lib/src/lib/my-lib.service.ts' )
183
+ ) . toBeFalsy ( ) ;
184
+ expect (
185
+ tree . exists ( 'libs/my-dir/my-lib/src/lib/my-lib.service.spec.ts' )
186
+ ) . toBeFalsy ( ) ;
143
187
} ) ;
144
188
145
189
it ( 'should update ng-package.json' , ( ) => {
@@ -183,6 +227,9 @@ describe('lib', () => {
183
227
expect ( tsconfigJson . compilerOptions . paths [ '@proj/my-dir/my-lib' ] ) . toEqual (
184
228
[ 'libs/my-dir/my-lib/src/index.ts' ]
185
229
) ;
230
+ expect (
231
+ tsconfigJson . compilerOptions . paths [ 'my-dir-my-lib/*' ]
232
+ ) . toBeUndefined ( ) ;
186
233
} ) ;
187
234
} ) ;
188
235
0 commit comments