Skip to content

Commit 6ce2f7a

Browse files
committed
test(linter/plugins): rename dirs in nested tests (#15888)
Rename the directories containing files to lint in the nested config tests from `nested` to `files`, to match the rest, and only lint the `files` directories. I don't think this has any effect on the operation of the tests, but makes it easier to lint these directories as part of the repo (#15887). This also removes the need for `overrideFiles` property in `testFixture` function's options, so remove it.
1 parent a72b093 commit 6ce2f7a

File tree

7 files changed

+7
-18
lines changed

7 files changed

+7
-18
lines changed

apps/oxlint/test/e2e.test.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ interface TestOptions {
1515
snapshotName?: string;
1616
// Function to get extra data to include in the snapshot
1717
getExtraSnapshotData?: (dirPath: string) => Promise<Record<string, string>>;
18-
19-
/**
20-
* Override the `files` directory within the fixture to lint.
21-
* This is useful when the fixture has a different structure, e.g. when testing nested configs.
22-
* Defaults to `files`.
23-
*/
24-
overrideFiles?: string;
2518
}
2619

2720
/**
@@ -36,7 +29,7 @@ async function testFixture(fixtureName: string, options?: TestOptions): Promise<
3629
// Use current NodeJS executable, rather than `node`, to avoid problems with a Node version manager
3730
// installed on system resulting in using wrong NodeJS version
3831
command: process.execPath,
39-
args: [CLI_PATH, ...args, options?.overrideFiles ?? 'files'],
32+
args: [CLI_PATH, ...args, 'files'],
4033
fixtureName,
4134
snapshotName: options?.snapshotName ?? 'output',
4235
getExtraSnapshotData: options?.getExtraSnapshotData,
@@ -82,14 +75,10 @@ describe('oxlint CLI', () => {
8275
});
8376

8477
it('should load a custom plugin correctly when extending in a nested config', async () => {
85-
await testFixture('custom_plugin_nested_config', {
86-
overrideFiles: '.',
87-
});
78+
await testFixture('custom_plugin_nested_config');
8879
});
8980
it('should do something', async () => {
90-
await testFixture('custom_plugin_nested_config_duplicate', {
91-
overrideFiles: '.',
92-
});
81+
await testFixture('custom_plugin_nested_config_duplicate');
9382
});
9483

9584
it('should load a custom plugin when configured in overrides', async () => {

apps/oxlint/test/fixtures/custom_plugin_nested_config/output.snap.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
# stdout
55
```
66
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
7-
,-[nested/index.ts:1:1]
7+
,-[files/index.ts:1:1]
88
1 | debugger;
99
: ^^^^^^^^^
1010
`----
1111
1212
Found 0 warnings and 1 error.
13-
Finished in Xms on 2 files using X threads.
13+
Finished in Xms on 1 file using X threads.
1414
```
1515

1616
# stderr

apps/oxlint/test/fixtures/custom_plugin_nested_config_duplicate/output.snap.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
# stdout
55
```
66
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
7-
,-[nested/index.ts:1:1]
7+
,-[files/index.ts:1:1]
88
1 | debugger;
99
: ^^^^^^^^^
1010
`----
1111
1212
Found 0 warnings and 1 error.
13-
Finished in Xms on 2 files using X threads.
13+
Finished in Xms on 1 file using X threads.
1414
```
1515

1616
# stderr

0 commit comments

Comments
 (0)