From 1647d550b1ba4bf8653d6ddb19b71b84088f639f Mon Sep 17 00:00:00 2001 From: Craigory Coppola Date: Thu, 4 Apr 2024 16:02:35 -0400 Subject: [PATCH] chore(repo): fix hanging test --- .../src/utils/convert-nx-executor.spec.ts | 17 +++++++++++++++-- .../utils/retrieve-workspace-files.ts | 6 +----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/packages/devkit/src/utils/convert-nx-executor.spec.ts b/packages/devkit/src/utils/convert-nx-executor.spec.ts index d212316ea821e..c61f00ac7fcef 100644 --- a/packages/devkit/src/utils/convert-nx-executor.spec.ts +++ b/packages/devkit/src/utils/convert-nx-executor.spec.ts @@ -2,8 +2,22 @@ import { TempFs } from '../../internal-testing-utils'; import { convertNxExecutor } from './convert-nx-executor'; describe('Convert Nx Executor', () => { + let fs: TempFs; + + beforeAll(async () => { + fs = new TempFs('convert-nx-executor'); + // The tests in this file don't actually care about the files in the temp dir. + // The converted executor reads project configuration from the workspace root, + // which is set to the temp dir in the tests. If there are no files in the temp + // dir, the glob search currently hangs. So we create a dummy file to prevent that. + await fs.createFile('blah.json', JSON.stringify({})); + }); + + afterAll(() => { + fs.cleanup(); + }); + it('should convertNxExecutor to builder correctly and produce the same output', async () => { - const fs = new TempFs('convert-nx-executor'); // ARRANGE const { schema } = require('@angular-devkit/core'); const { @@ -89,7 +103,6 @@ describe('Convert Nx Executor', () => { expect(convertedExecutor.handler.toString()).toEqual( realBuilder.handler.toString() ); - fs.cleanup(); }); }); diff --git a/packages/nx/src/project-graph/utils/retrieve-workspace-files.ts b/packages/nx/src/project-graph/utils/retrieve-workspace-files.ts index a5c91cce1a96a..1b54a2154c0b5 100644 --- a/packages/nx/src/project-graph/utils/retrieve-workspace-files.ts +++ b/packages/nx/src/project-graph/utils/retrieve-workspace-files.ts @@ -95,11 +95,7 @@ export async function retrieveProjectConfigurationsWithAngularProjects( workspaceRoot ); - const res = _retrieveProjectConfigurations( - workspaceRoot, - nxJson, - await plugins - ); + const res = _retrieveProjectConfigurations(workspaceRoot, nxJson, plugins); cleanup(); return res; }