diff --git a/packages/nx/src/command-line/run-many/run-many.spec.ts b/packages/nx/src/command-line/run-many/run-many.spec.ts index c2aa94cd1821e..5116e9d47c142 100644 --- a/packages/nx/src/command-line/run-many/run-many.spec.ts +++ b/packages/nx/src/command-line/run-many/run-many.spec.ts @@ -189,8 +189,8 @@ describe('run-many', () => { } }); - it('should be able to select and exclude via patterns', async () => { - performance.mark('start'); + it('should be able to select and exclude via patterns', () => { + const start = performance.now(); projectsToRun( { targets: ['test'], @@ -199,9 +199,8 @@ describe('run-many', () => { }, projectGraph ); - performance.mark('end'); - const measure = performance.measure('projects', 'start', 'end'); - expect(measure.duration).toBeLessThan(10000); + const end = performance.now(); + expect(end - start).toBeLessThan(10000); }); }); }); diff --git a/packages/nx/src/command-line/show/projects.spec.ts b/packages/nx/src/command-line/show/projects.spec.ts index b62d0d22e55e7..fbc69a62dc694 100644 --- a/packages/nx/src/command-line/show/projects.spec.ts +++ b/packages/nx/src/command-line/show/projects.spec.ts @@ -26,6 +26,7 @@ performance.measure = jest.fn(); describe('show projects', () => { beforeEach(() => { jest.spyOn(console, 'log').mockImplementation(() => {}); + performance.mark('init-local'); }); afterEach(() => { jest.clearAllMocks(); diff --git a/packages/nx/src/project-graph/affected/affected-project-graph.ts b/packages/nx/src/project-graph/affected/affected-project-graph.ts index 52cc5c8f0f218..26cd04dd1a344 100644 --- a/packages/nx/src/project-graph/affected/affected-project-graph.ts +++ b/packages/nx/src/project-graph/affected/affected-project-graph.ts @@ -30,6 +30,7 @@ export async function filterAffected( const touchedProjects = []; for (const locator of touchedProjectLocators) { + performance.mark(locator.name + ':start'); const projects = await locator( touchedFiles, graph.nodes, @@ -37,6 +38,12 @@ export async function filterAffected( packageJson, graph ); + performance.mark(locator.name + ':end'); + performance.measure( + locator.name, + locator.name + ':start', + locator.name + ':end' + ); touchedProjects.push(...projects); } diff --git a/packages/nx/src/project-graph/utils/retrieve-workspace-files.spec.ts b/packages/nx/src/project-graph/utils/retrieve-workspace-files.spec.ts index 4499637562e47..b75b214284730 100644 --- a/packages/nx/src/project-graph/utils/retrieve-workspace-files.spec.ts +++ b/packages/nx/src/project-graph/utils/retrieve-workspace-files.spec.ts @@ -27,12 +27,11 @@ describe('retrieveProjectConfigurationPaths', () => { const configPaths = await retrieveProjectConfigurationPaths(fs.tempDir, [ { + name: 'test', createNodes: [ '{project.json,**/project.json}', - () => { - return { - projects: {}, - }; + async () => { + return []; }, ], },