@@ -233,21 +233,19 @@ describe('normalizedCreateNodesV2Context', () => {
233233 config : { name : 'my-lib' , root : projectRoot , targets : { } } ,
234234 } ) ;
235235
236- const result = await normalizedCreateNodesV2Context (
237- createNodesV2Context ( { workspaceRoot : MEMFS_VOLUME } ) ,
238- projectJsonPath ( projectRoot ) ,
239- ) ;
240-
241- expect ( result ) . toStrictEqual (
236+ await expect (
237+ normalizedCreateNodesV2Context (
238+ createNodesV2Context ( { workspaceRoot : MEMFS_VOLUME } ) ,
239+ projectJsonPath ( projectRoot ) ,
240+ ) ,
241+ ) . resolves . toStrictEqual (
242242 expect . objectContaining ( {
243+ projectRoot : expect . pathToMatch ( `${ MEMFS_VOLUME } /${ projectRoot } ` ) ,
243244 workspaceRoot : MEMFS_VOLUME ,
244245 projectJson : { name : 'my-lib' , root : projectRoot , targets : { } } ,
245246 createOptions : { targetName : CP_TARGET_NAME } ,
246247 } ) ,
247248 ) ;
248- expect ( osAgnosticPath ( result . projectRoot ) ) . toBe (
249- osAgnosticPath ( `${ MEMFS_VOLUME } /${ projectRoot } ` ) ,
250- ) ;
251249 } ) ;
252250
253251 it ( 'should normalize context with custom target name' , async ( ) => {
@@ -258,21 +256,19 @@ describe('normalizedCreateNodesV2Context', () => {
258256 config : { name : 'my-lib' , root : projectRoot , targets : { } } ,
259257 } ) ;
260258
261- const result = await normalizedCreateNodesV2Context (
262- createNodesV2Context ( { workspaceRoot : MEMFS_VOLUME } ) ,
263- projectJsonPath ( projectRoot ) ,
264- { targetName : customTargetName } ,
265- ) ;
266-
267- expect ( result ) . toStrictEqual (
259+ await expect (
260+ normalizedCreateNodesV2Context (
261+ createNodesV2Context ( { workspaceRoot : MEMFS_VOLUME } ) ,
262+ projectJsonPath ( projectRoot ) ,
263+ { targetName : customTargetName } ,
264+ ) ,
265+ ) . resolves . toStrictEqual (
268266 expect . objectContaining ( {
267+ projectRoot : expect . pathToMatch ( `${ MEMFS_VOLUME } /${ projectRoot } ` ) ,
269268 projectJson : { name : 'my-lib' , root : projectRoot , targets : { } } ,
270269 createOptions : { targetName : customTargetName } ,
271270 } ) ,
272271 ) ;
273- expect ( osAgnosticPath ( result . projectRoot ) ) . toBe (
274- osAgnosticPath ( `${ MEMFS_VOLUME } /${ projectRoot } ` ) ,
275- ) ;
276272 } ) ;
277273
278274 it ( 'should extract project root from project.json path' , async ( ) => {
@@ -282,62 +278,70 @@ describe('normalizedCreateNodesV2Context', () => {
282278 config : { name : 'utils' , root : projectRoot , targets : { } } ,
283279 } ) ;
284280
285- const result = await normalizedCreateNodesV2Context (
286- createNodesV2Context ( { workspaceRoot : MEMFS_VOLUME } ) ,
287- projectJsonPath ( projectRoot ) ,
288- ) ;
289-
290- expect ( osAgnosticPath ( result . projectRoot ) ) . toBe (
291- osAgnosticPath ( `${ MEMFS_VOLUME } /${ projectRoot } ` ) ,
281+ await expect (
282+ normalizedCreateNodesV2Context (
283+ createNodesV2Context ( { workspaceRoot : MEMFS_VOLUME } ) ,
284+ projectJsonPath ( projectRoot ) ,
285+ ) ,
286+ ) . resolves . toStrictEqual (
287+ expect . objectContaining ( {
288+ projectRoot : expect . pathToMatch ( `${ MEMFS_VOLUME } /${ projectRoot } ` ) ,
289+ } ) ,
292290 ) ;
293291 } ) ;
294292
295293 it ( 'should preserve all context properties' , async ( ) => {
296294 const projectRoot = 'libs/my-lib' ;
295+ const nxJsonConfiguration = {
296+ namedInputs : { default : [ '{projectRoot}/**/*' ] } ,
297+ } ;
297298 setupProjectJson ( {
298299 projectRoot,
299300 config : { name : 'my-lib' , root : projectRoot , targets : { } } ,
300301 } ) ;
301302
302- const nxJsonConfiguration = {
303- namedInputs : { default : [ '{projectRoot}/**/*' ] } ,
304- } ;
305-
306- const result = await normalizedCreateNodesV2Context (
307- createNodesV2Context ( {
303+ await expect (
304+ normalizedCreateNodesV2Context (
305+ createNodesV2Context ( {
306+ workspaceRoot : MEMFS_VOLUME ,
307+ nxJsonConfiguration,
308+ } ) ,
309+ projectJsonPath ( projectRoot ) ,
310+ ) ,
311+ ) . resolves . toStrictEqual (
312+ expect . objectContaining ( {
313+ projectRoot : expect . pathToMatch ( `${ MEMFS_VOLUME } /${ projectRoot } ` ) ,
308314 workspaceRoot : MEMFS_VOLUME ,
309315 nxJsonConfiguration,
316+ projectJson : { name : 'my-lib' , root : projectRoot , targets : { } } ,
317+ createOptions : { targetName : CP_TARGET_NAME } ,
310318 } ) ,
311- projectJsonPath ( projectRoot ) ,
312319 ) ;
313-
314- expect ( result . nxJsonConfiguration ) . toStrictEqual ( nxJsonConfiguration ) ;
315- expect ( result . workspaceRoot ) . toBe ( MEMFS_VOLUME ) ;
316- expect ( result . projectJson ) . toBeDefined ( ) ;
317- expect ( result . projectRoot ) . toBeDefined ( ) ;
318- expect ( result . createOptions ) . toBeDefined ( ) ;
319320 } ) ;
320321
321322 it ( 'should preserve createOptions properties' , async ( ) => {
322323 const projectRoot = 'libs/my-lib' ;
323- setupProjectJson ( {
324- projectRoot,
325- config : { name : 'my-lib' , root : projectRoot , targets : { } } ,
326- } ) ;
327-
328324 const createOptions = {
329325 targetName : 'custom-target' ,
330326 projectPrefix : 'cli' ,
331327 bin : 'packages/cli/dist' ,
332328 } ;
329+ setupProjectJson ( {
330+ projectRoot,
331+ config : { name : 'my-lib' , root : projectRoot , targets : { } } ,
332+ } ) ;
333333
334- const result = await normalizedCreateNodesV2Context (
335- createNodesV2Context ( { workspaceRoot : MEMFS_VOLUME } ) ,
336- projectJsonPath ( projectRoot ) ,
337- createOptions ,
334+ await expect (
335+ normalizedCreateNodesV2Context (
336+ createNodesV2Context ( { workspaceRoot : MEMFS_VOLUME } ) ,
337+ projectJsonPath ( projectRoot ) ,
338+ createOptions ,
339+ ) ,
340+ ) . resolves . toStrictEqual (
341+ expect . objectContaining ( {
342+ createOptions,
343+ } ) ,
338344 ) ;
339-
340- expect ( result . createOptions ) . toStrictEqual ( createOptions ) ;
341345 } ) ;
342346
343347 it ( 'should throw error when project.json file cannot be read' , async ( ) => {
0 commit comments