1- import type { CreateNodesContextV2 } from '@nx/devkit' ;
1+ import type { CreateNodesContextV2 , CreateNodesResultV2 } from '@nx/devkit' ;
22import { vol } from 'memfs' ;
33import { afterEach , beforeEach , describe , expect } from 'vitest' ;
44import { MEMFS_VOLUME } from '@code-pushup/test-utils' ;
@@ -48,11 +48,12 @@ describe('@code-pushup/nx-plugin/plugin', () => {
4848 ) ;
4949
5050 expect ( result ) . toHaveLength ( 1 ) ;
51- const [ file , nodesResult ] = result [ 0 ] ;
51+ const [ file , nodesResult ] = result [ 0 ] as CreateNodesResultV2 [ number ] ;
5252 expect ( file ) . toBe ( projectJsonPath ( projectRoot ) ) ;
53- // The projectRoot in the result will be the absolute path from path.dirname()
54- const actualProjectRoot = Object . keys ( nodesResult . projects ) [ 0 ] ;
55- expect ( nodesResult . projects [ actualProjectRoot ] ) . toStrictEqual ( {
53+ const actualProjectRoot = Object . keys (
54+ nodesResult . projects ?? { } ,
55+ ) [ 0 ] as string ;
56+ expect ( nodesResult . projects ) . toHaveProperty ( actualProjectRoot , {
5657 targets : {
5758 [ `${ CP_TARGET_NAME } --configuration` ] : {
5859 command : `nx g ${ PACKAGE_NAME } :configuration --project="@org/empty-root"` ,
@@ -72,9 +73,11 @@ describe('@code-pushup/nx-plugin/plugin', () => {
7273 ) ;
7374
7475 expect ( result ) . toHaveLength ( 1 ) ;
75- const [ file , nodesResult ] = result [ 0 ] ;
76+ const [ file , nodesResult ] = result [ 0 ] as CreateNodesResultV2 [ number ] ;
7677 expect ( file ) . toBe ( projectJsonPath ( projectRoot ) ) ;
77- const actualProjectRoot = Object . keys ( nodesResult . projects ) [ 0 ] ?? '' ;
78+ const actualProjectRoot = Object . keys (
79+ nodesResult . projects ?? { } ,
80+ ) [ 0 ] as string ;
7881 expect ( nodesResult . projects ) . toHaveProperty ( actualProjectRoot , {
7982 targets : {
8083 [ `${ CP_TARGET_NAME } --configuration` ] : {
@@ -97,10 +100,12 @@ describe('@code-pushup/nx-plugin/plugin', () => {
97100 ) ;
98101
99102 expect ( result ) . toHaveLength ( 1 ) ;
100- const [ file , nodesResult ] = result [ 0 ] ;
103+ const [ file , nodesResult ] = result [ 0 ] as CreateNodesResultV2 [ number ] ;
101104 expect ( file ) . toBe ( projectJsonPath ( projectRoot ) ) ;
102- const actualProjectRoot = Object . keys ( nodesResult . projects ) [ 0 ] ;
103- expect ( nodesResult . projects [ actualProjectRoot ] ) . toStrictEqual ( {
105+ const actualProjectRoot = Object . keys (
106+ nodesResult . projects ?? { } ,
107+ ) [ 0 ] as string ;
108+ expect ( nodesResult . projects ) . toHaveProperty ( actualProjectRoot , {
104109 targets : {
105110 [ CP_TARGET_NAME ] : {
106111 executor : `${ PACKAGE_NAME } :cli` ,
@@ -125,10 +130,12 @@ describe('@code-pushup/nx-plugin/plugin', () => {
125130 ) ;
126131
127132 expect ( result ) . toHaveLength ( 1 ) ;
128- const [ file , nodesResult ] = result [ 0 ] ;
133+ const [ file , nodesResult ] = result [ 0 ] as CreateNodesResultV2 [ number ] ;
129134 expect ( file ) . toBe ( projectJsonPath ( projectRoot ) ) ;
130- const actualProjectRoot = Object . keys ( nodesResult . projects ) [ 0 ] ;
131- expect ( nodesResult . projects [ actualProjectRoot ] ) . toStrictEqual ( {
135+ const actualProjectRoot = Object . keys (
136+ nodesResult . projects ?? { } ,
137+ ) [ 0 ] as string ;
138+ expect ( nodesResult . projects ) . toHaveProperty ( actualProjectRoot , {
132139 targets : {
133140 [ CP_TARGET_NAME ] : {
134141 executor : `${ PACKAGE_NAME } :cli` ,
0 commit comments