Skip to content

Commit ff5997c

Browse files
feat: add eslint-config option to run command
Enables custom ESLint configurations for config-based benchmarks. This extends the same functionality that was already available in run-single command to the run command for consistency.
1 parent cb5e4e6 commit ff5997c

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

cli/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ interface RunCommandOptions {
6969
*/
7070
report?: ReporterFormat
7171

72+
/** Optional. Path to an ESLint configuration file to use for linting. */
73+
eslintConfig?: string
74+
7275
/**
7376
* Optional. Path to the benchmark configuration file. If not provided,
7477
* searches for default config files.
@@ -108,6 +111,7 @@ export function run(): void {
108111
cli
109112
.command('run', 'Run benchmarks from config')
110113
.option('--config <path>', 'Path to configuration file')
114+
.option('--eslint-config <config>', 'Path to ESLint config file')
111115
.option('--report <format>', 'Report format (console, json, markdown)', {
112116
default: DEFAULT_REPORTER_FORMAT,
113117
})
@@ -135,6 +139,7 @@ export function run(): void {
135139
]
136140

137141
await runBenchmarksFromConfig({
142+
eslintConfigFile: options.eslintConfig,
138143
reporterOptions: reporterOptionsArray,
139144
userConfig: config,
140145
configDirectory,

test/runners/run-benchmarks-from-config.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,4 +833,25 @@ describe('runBenchmarksFromConfig', () => {
833833
configDirectory,
834834
})
835835
})
836+
837+
it('should pass eslintConfigFile parameter to runBenchmark when provided', async () => {
838+
let customEslintConfigPath = '/path/to/custom/eslint.config.js'
839+
840+
await runBenchmarksFromConfig({
841+
eslintConfigFile: customEslintConfigPath,
842+
reporterOptions: mockReporterOptions,
843+
userConfig: mockUserConfig,
844+
configDirectory,
845+
})
846+
847+
expect(mockedRunBenchmark).toHaveBeenCalledWith({
848+
config: expect.objectContaining({
849+
warmup: expect.any(Object) as object,
850+
name: expect.any(String) as string,
851+
}) as object,
852+
testCases: expect.any(Array) as unknown as TestCase[],
853+
eslintConfigFile: customEslintConfigPath,
854+
configDirectory,
855+
})
856+
})
836857
})

0 commit comments

Comments
 (0)