Skip to content

Commit 52642c8

Browse files
committed
test(plugin-eslint): add test case for code-pushup.eslintrc resolution
1 parent ab62f2f commit 52642c8

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

packages/plugin-eslint/src/lib/nx.integration.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ describe('Nx helpers', () => {
105105
* utils ◄──────┘
106106
*/
107107

108-
const allProjects = ['cli', 'core', 'nx-plugin', 'utils'] as const;
109-
type Project = (typeof allProjects)[number];
108+
const ALL_PROJECTS = ['cli', 'core', 'nx-plugin', 'utils'] as const;
109+
type Project = (typeof ALL_PROJECTS)[number];
110110

111111
it.each<[Project, Project[]]>([
112112
['cli', ['cli', 'core', 'utils']],
@@ -116,7 +116,7 @@ describe('Nx helpers', () => {
116116
])(
117117
'project %j - expected configurations for projects %j',
118118
async (project, expectedProjects) => {
119-
const otherProjects = allProjects.filter(
119+
const otherProjects = ALL_PROJECTS.filter(
120120
p => !expectedProjects.includes(p),
121121
);
122122

packages/plugin-eslint/src/lib/nx/utils.unit.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,21 @@ describe('find code-pushup.eslintrc.* file', () => {
4646
).resolves.toBe('./packages/core/code-pushup.eslintrc.js');
4747
});
4848

49+
it('should look for JSON extension before JavaScript', async () => {
50+
vol.fromJSON(
51+
{
52+
'libs/utils/code-pushup.eslintrc.js':
53+
"module.exports = { extends: '@code-pushup' };",
54+
'libs/utils/code-pushup.eslintrc.json': '{ "extends": "@code-pushup" }',
55+
},
56+
MEMFS_VOLUME,
57+
);
58+
59+
await expect(findCodePushupEslintrc({ root: 'libs/utils' })).resolves.toBe(
60+
'./libs/utils/code-pushup.eslintrc.json',
61+
);
62+
});
63+
4964
it('should look for JavaScript extensions before YAML', async () => {
5065
vol.fromJSON(
5166
{

0 commit comments

Comments
 (0)