Skip to content

Commit

Permalink
chore(core): fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed Dec 2, 2024
1 parent 2260002 commit b291fac
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 15 deletions.
3 changes: 3 additions & 0 deletions packages/nx/src/command-line/show/projects.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jest.mock('../../project-graph/project-graph', () => ({
.mockImplementation(() => Promise.resolve(graph)),
}));

performance.mark = jest.fn();
performance.measure = jest.fn();

describe('show projects', () => {
beforeEach(() => {
jest.spyOn(console, 'log').mockImplementation(() => {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
ProjectConfigurationsError,
isAggregateProjectGraphError,
} from '../../project-graph/error-types';
import { getPlugins } from '../../project-graph/plugins';
import { getPlugins } from '../../project-graph/plugins/get-plugins';

interface SerializedProjectGraph {
error: Error | null;
Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/daemon/server/shutdown-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ProjectGraphError,
} from '../../project-graph/error-types';
import { removeDbConnections } from '../../utils/db-connection';
import { cleanupPlugins } from '../../project-graph/plugins';
import { cleanupPlugins } from '../../project-graph/plugins/get-plugins';

export const SERVER_INACTIVITY_TIMEOUT_MS = 10800000 as const; // 10800000 ms = 3 hours

Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/executors/utils/convert-nx-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Executor, ExecutorContext } from '../../config/misc-interfaces';
import { retrieveProjectConfigurations } from '../../project-graph/utils/retrieve-workspace-files';
import { readProjectConfigurationsFromRootMap } from '../../project-graph/utils/project-configuration-utils';
import { ProjectsConfigurations } from '../../config/workspace-json-project-json';
import { getPlugins } from '../../project-graph/plugins';
import { getPlugins } from '../../project-graph/plugins/get-plugins';

/**
* Convert an Nx Executor into an Angular Devkit Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { join } from 'path';
import { existsSync } from 'fs';
import { configurationGlobs } from '../../utils/retrieve-workspace-files';
import { combineGlobPatterns } from '../../../utils/globs';
import { getPlugins } from '../../plugins';
import { getPlugins } from '../../plugins/get-plugins';

export const getTouchedProjectsFromProjectGlobChanges: TouchedProjectLocator =
async (touchedFiles, projectGraphNodes): Promise<string[]> => {
Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/project-graph/error-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from './utils/project-configuration-utils';
import { ProjectConfiguration } from '../config/workspace-json-project-json';
import { ProjectGraph } from '../config/project-graph';
import { CreateNodesFunctionV2 } from './plugins';
import { CreateNodesFunctionV2 } from './plugins/public-api';

export class ProjectGraphError extends Error {
readonly #errors: Array<
Expand Down
5 changes: 1 addition & 4 deletions packages/nx/src/project-graph/plugins/get-plugins.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { hashObject } from '../../hasher/file-hasher';
import { readNxJson } from '../../config/nx-json';
import {
LoadedNxPlugin,
loadNxPlugins,
} from '../../project-graph/plugins/internal-api';
import { LoadedNxPlugin, loadNxPlugins } from './internal-api';
import { workspaceRoot } from '../../utils/workspace-root';

let currentPluginsConfigurationHash: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/project-graph/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from './public-api';

export * from './get-plugins';
// export * from './get-plugins';

export { readPluginPackageJson, registerPluginTSTranspiler } from './loader';
export { createNodesFromFiles } from './utils';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { consumeMessage, isPluginWorkerMessage } from './messaging';
import type { LoadedNxPlugin } from '../internal-api';
import { createSerializableError } from '../../../utils/serializable-error';
import { consumeMessagesFromSocket } from '../../../utils/consume-messages-from-socket';

Expand All @@ -13,7 +12,7 @@ if (process.env.NX_PERF_LOGGING === 'true') {
global.NX_GRAPH_CREATION = true;
global.NX_PLUGIN_WORKER = true;
let connected = false;
let plugin: LoadedNxPlugin;
let plugin;

const socketPath = process.argv[2];

Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/project-graph/project-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
retrieveProjectConfigurations,
retrieveWorkspaceFiles,
} from './utils/retrieve-workspace-files';
import { getPlugins } from './plugins';
import { getPlugins } from './plugins/get-plugins';

/**
* Synchronously reads the latest cached copy of the workspace's ProjectGraph.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
isAggregateCreateNodesError,
AggregateCreateNodesError,
} from '../error-types';
import { CreateNodesResult } from '../plugins';
import { CreateNodesResult } from '../plugins/public-api';
import { isGlobPattern } from '../../utils/globs';

export type SourceInformation = [file: string | null, plugin: string];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from '../../utils/workspace-context';
import { buildAllWorkspaceFiles } from './build-all-workspace-files';
import { join } from 'path';
import { getOnlyDefaultPlugins, getPlugins } from '../plugins';
import { getOnlyDefaultPlugins, getPlugins } from '../plugins/get-plugins';

/**
* Walks the workspace directory to create the `projectFileMap`, `ProjectConfigurations` and `allWorkspaceFiles`
Expand Down

0 comments on commit b291fac

Please sign in to comment.