Skip to content

Commit

Permalink
chore(misc): failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed May 30, 2024
1 parent d17a94b commit 1605f10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/eslint/src/plugins/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import 'nx/src/internal-testing-utils/mock-fs';
let fsRoot: string = '';

jest.mock(
'nx/src/utils/globs',
(): Partial<typeof import('nx/src/utils/globs')> => {
'nx/src/utils/workspace-context',
(): Partial<typeof import('nx/src/utils/workspace-context')> => {
const glob: typeof import('fast-glob') = require('fast-glob');
return {
...jest.requireActual('nx/src/utils/globs'),
globAsync(patterns: string[]) {
globWithWorkspaceContext(root: string, patterns: string[]) {
// This glob will operate on memfs thanks to 'nx/src/internal-testing-utils/mock-fs'
return glob(patterns, { cwd: fsRoot });
},
Expand Down
8 changes: 5 additions & 3 deletions packages/eslint/src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
import { existsSync } from 'node:fs';
import { dirname, join, normalize, sep } from 'node:path';
import { combineGlobPatterns } from 'nx/src/utils/globs';
import { globAsync } from 'nx/src/utils/globs';
import {
ESLINT_CONFIG_FILENAMES,
baseEsLintConfigFile,
Expand All @@ -16,6 +15,7 @@ import {
} from '../utils/config-file';
import { resolveESLintClass } from '../utils/resolve-eslint-class';
import { gte } from 'semver';
import { globWithWorkspaceContext } from 'nx/src/utils/workspace-context';

export interface EslintPluginOptions {
targetName?: string;
Expand Down Expand Up @@ -51,7 +51,8 @@ export const createNodes: CreateNodes<EslintPluginOptions> = [
}
}

const projectFiles = await globAsync(
const projectFiles = await globWithWorkspaceContext(
context.workspaceRoot,
[
'project.json',
'package.json',
Expand All @@ -76,7 +77,8 @@ export const createNodes: CreateNodes<EslintPluginOptions> = [
const nestedProjectRootPatterns = excludePatterns.slice(index + 1);

// Ignore project roots where the project does not contain any lintable files
const lintableFiles = await globAsync(
const lintableFiles = await globWithWorkspaceContext(
context.workspaceRoot,
[join(childProjectRoot, `**/*.{${options.extensions.join(',')}}`)],
// exclude nested eslint roots and nested project roots
[...nestedEslintRootPatterns, ...nestedProjectRootPatterns]
Expand Down

0 comments on commit 1605f10

Please sign in to comment.