Skip to content

Commit

Permalink
test(plugin-eslint): fix project graph errors in nx integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
matejchalk committed Dec 17, 2024
1 parent 31bed82 commit 284f755
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "cli",
"sourceRoot": "packages/cli/src",
"projectType": "application",
"implicitDependencies": ["core"],
"targets": {
"lint": {
"executor": "@nx/eslint:lint"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "core",
"sourceRoot": "packages/core/src",
"projectType": "library",
"implicitDependencies": ["utils"],
"targets": {
"lint": {
"executor": "@nx/eslint:lint"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "nx-plugin",
"sourceRoot": "packages/nx-plugin/src",
"projectType": "library",
"implicitDependencies": ["utils"],
"targets": {
"lint": {
"executor": "@nx/eslint:lint"
Expand Down
9 changes: 8 additions & 1 deletion packages/plugin-eslint/src/lib/nx.integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import type { MockInstance } from 'vitest';
import { executeProcess } from '@code-pushup/utils';
import type { ESLintTarget } from './config.js';
import { eslintConfigFromNxProject } from './nx/find-project-without-deps.js';
import {
Expand All @@ -13,7 +14,7 @@ type Project = 'cli' | 'core' | 'nx-plugin' | 'utils';
describe('Nx helpers', () => {
let cwdSpy: MockInstance<[], string>;

beforeAll(() => {
beforeAll(async () => {
const workspaceDir = path.join(
fileURLToPath(path.dirname(import.meta.url)),
'..',
Expand All @@ -23,6 +24,12 @@ describe('Nx helpers', () => {
'nx-monorepo',
);
cwdSpy = vi.spyOn(process, 'cwd').mockReturnValue(workspaceDir);

// HACK: somehow prevents "Failed to process project graph" errors
await executeProcess({
command: 'npx nx graph --file=.nx/graph.json',
cwd: workspaceDir,
});
});

afterAll(() => {
Expand Down

0 comments on commit 284f755

Please sign in to comment.