@@ -29,7 +29,7 @@ describe('create-nx-workspace --preset=npm', () => {
2929
3030 afterEach ( ( ) => {
3131 // cleanup previous projects
32- runCommand ( `rm -rf packages/** tsconfig.base.json` ) ;
32+ runCommand ( `rm -rf packages/** tsconfig.base.json tsconfig.json ` ) ;
3333 } ) ;
3434
3535 afterAll ( ( ) => {
@@ -80,11 +80,14 @@ describe('create-nx-workspace --preset=npm', () => {
8080 expect ( ( ) =>
8181 runCLI ( `generate @nx/js:library packages/${ libName } --no-interactive` )
8282 ) . not . toThrow ( ) ;
83- checkFilesExist ( 'tsconfig.base.json' ) ;
84- const tsconfig = readJson ( `tsconfig.base.json` ) ;
85- expect ( tsconfig . compilerOptions . paths ) . toEqual ( {
86- [ `@${ wsName } /${ libName } ` ] : [ `packages/${ libName } /src/index.ts` ] ,
87- } ) ;
83+ checkFilesExist ( 'tsconfig.base.json' , 'tsconfig.json' ) ;
84+ const tsconfigBase = readJson ( `tsconfig.base.json` ) ;
85+ expect ( tsconfigBase . compilerOptions . paths ) . toBeUndefined ( ) ;
86+ const tsconfig = readJson ( `tsconfig.json` ) ;
87+ expect ( tsconfig . extends ) . toBe ( './tsconfig.base.json' ) ;
88+ expect ( tsconfig . references ) . toStrictEqual ( [
89+ { path : `./packages/${ libName } ` } ,
90+ ] ) ;
8891 } ) ;
8992
9093 it ( 'should add web application' , ( ) => {
@@ -117,11 +120,14 @@ describe('create-nx-workspace --preset=npm', () => {
117120 expect ( ( ) => {
118121 runCLI ( `generate @nx/react:lib packages/${ libName } --no-interactive` ) ;
119122 } ) . not . toThrow ( ) ;
120- checkFilesExist ( 'tsconfig.base.json' ) ;
121- const tsconfig = readJson ( `tsconfig.base.json` ) ;
122- expect ( tsconfig . compilerOptions . paths ) . toEqual ( {
123- [ `@${ wsName } /${ libName } ` ] : [ `packages/${ libName } /src/index.ts` ] ,
124- } ) ;
123+ checkFilesExist ( 'tsconfig.base.json' , 'tsconfig.json' ) ;
124+ const tsconfigBase = readJson ( `tsconfig.base.json` ) ;
125+ expect ( tsconfigBase . compilerOptions . paths ) . toBeUndefined ( ) ;
126+ const tsconfig = readJson ( `tsconfig.json` ) ;
127+ expect ( tsconfig . extends ) . toBe ( './tsconfig.base.json' ) ;
128+ expect ( tsconfig . references ) . toStrictEqual ( [
129+ { path : `./packages/${ libName } ` } ,
130+ ] ) ;
125131 } ) ;
126132
127133 it ( 'should add next application' , ( ) => {
@@ -143,12 +149,14 @@ describe('create-nx-workspace --preset=npm', () => {
143149 expect ( ( ) => {
144150 runCLI ( `generate @nx/next:lib packages/${ libName } --no-interactive` ) ;
145151 } ) . not . toThrow ( ) ;
146- checkFilesExist ( 'tsconfig.base.json' ) ;
147- const tsconfig = readJson ( `tsconfig.base.json` ) ;
148- expect ( tsconfig . compilerOptions . paths ) . toEqual ( {
149- [ `@${ wsName } /${ libName } ` ] : [ `packages/${ libName } /src/index.ts` ] ,
150- [ `@${ wsName } /${ libName } /server` ] : [ `packages/${ libName } /src/server.ts` ] ,
151- } ) ;
152+ checkFilesExist ( 'tsconfig.base.json' , 'tsconfig.json' ) ;
153+ const tsconfigBase = readJson ( `tsconfig.base.json` ) ;
154+ expect ( tsconfigBase . compilerOptions . paths ) . toBeUndefined ( ) ;
155+ const tsconfig = readJson ( `tsconfig.json` ) ;
156+ expect ( tsconfig . extends ) . toBe ( './tsconfig.base.json' ) ;
157+ expect ( tsconfig . references ) . toStrictEqual ( [
158+ { path : `./packages/${ libName } ` } ,
159+ ] ) ;
152160 } ) ;
153161
154162 it ( 'should add react-native application' , ( ) => {
@@ -174,11 +182,14 @@ describe('create-nx-workspace --preset=npm', () => {
174182 `generate @nx/react-native:lib packages/${ libName } --no-interactive`
175183 ) ;
176184 } ) . not . toThrow ( ) ;
177- checkFilesExist ( 'tsconfig.base.json' ) ;
178- const tsconfig = readJson ( `tsconfig.base.json` ) ;
179- expect ( tsconfig . compilerOptions . paths ) . toEqual ( {
180- [ `@${ wsName } /${ libName } ` ] : [ `packages/${ libName } /src/index.ts` ] ,
181- } ) ;
185+ checkFilesExist ( 'tsconfig.base.json' , 'tsconfig.json' ) ;
186+ const tsconfigBase = readJson ( `tsconfig.base.json` ) ;
187+ expect ( tsconfigBase . compilerOptions . paths ) . toBeUndefined ( ) ;
188+ const tsconfig = readJson ( `tsconfig.json` ) ;
189+ expect ( tsconfig . extends ) . toBe ( './tsconfig.base.json' ) ;
190+ expect ( tsconfig . references ) . toStrictEqual ( [
191+ { path : `./packages/${ libName } ` } ,
192+ ] ) ;
182193 } ) ;
183194
184195 it ( 'should add node application' , ( ) => {
@@ -200,11 +211,14 @@ describe('create-nx-workspace --preset=npm', () => {
200211 expect ( ( ) => {
201212 runCLI ( `generate @nx/node:lib packages/${ libName } --no-interactive` ) ;
202213 } ) . not . toThrow ( ) ;
203- checkFilesExist ( 'tsconfig.base.json' ) ;
204- const tsconfig = readJson ( `tsconfig.base.json` ) ;
205- expect ( tsconfig . compilerOptions . paths ) . toEqual ( {
206- [ `@${ wsName } /${ libName } ` ] : [ `packages/${ libName } /src/index.ts` ] ,
207- } ) ;
214+ checkFilesExist ( 'tsconfig.base.json' , 'tsconfig.json' ) ;
215+ const tsconfigBase = readJson ( `tsconfig.base.json` ) ;
216+ expect ( tsconfigBase . compilerOptions . paths ) . toBeUndefined ( ) ;
217+ const tsconfig = readJson ( `tsconfig.json` ) ;
218+ expect ( tsconfig . extends ) . toBe ( './tsconfig.base.json' ) ;
219+ expect ( tsconfig . references ) . toStrictEqual ( [
220+ { path : `./packages/${ libName } ` } ,
221+ ] ) ;
208222 } ) ;
209223
210224 it ( 'should add nest application' , ( ) => {
@@ -226,11 +240,14 @@ describe('create-nx-workspace --preset=npm', () => {
226240 expect ( ( ) => {
227241 runCLI ( `generate @nx/nest:lib packages/${ libName } --no-interactive` ) ;
228242 } ) . not . toThrow ( ) ;
229- checkFilesExist ( 'tsconfig.base.json' ) ;
230- const tsconfig = readJson ( `tsconfig.base.json` ) ;
231- expect ( tsconfig . compilerOptions . paths ) . toEqual ( {
232- [ `@${ wsName } /${ libName } ` ] : [ `packages/${ libName } /src/index.ts` ] ,
233- } ) ;
243+ checkFilesExist ( 'tsconfig.base.json' , 'tsconfig.json' ) ;
244+ const tsconfigBase = readJson ( `tsconfig.base.json` ) ;
245+ expect ( tsconfigBase . compilerOptions . paths ) . toBeUndefined ( ) ;
246+ const tsconfig = readJson ( `tsconfig.json` ) ;
247+ expect ( tsconfig . extends ) . toBe ( './tsconfig.base.json' ) ;
248+ expect ( tsconfig . references ) . toStrictEqual ( [
249+ { path : `./packages/${ libName } ` } ,
250+ ] ) ;
234251 } ) ;
235252
236253 it ( 'should add express application' , ( ) => {
0 commit comments