refactor: centralize Oxlint worker bounds

This commit is contained in:
Tianyi Cui
2026-07-29 23:39:49 +08:00
parent f7ee0bf0fd
commit e673524976
6 changed files with 83 additions and 30 deletions

View File

@@ -121,24 +121,17 @@ describe('Oxlint gate', () => {
})
})
it('passes the configured worker bound to both Oxlint backends', () => {
it('surfaces the configured worker bound on the shared package script', () => {
const subject = withEnv('DSH_OXLINT_THREADS', '4', () =>
withPnpmEntrypoint(() => gatesForMode('ci-lint')[0]))
expect(subject).toMatchObject({
id: 'lint',
displayCommand: 'pnpm exec oxlint . --threads=4',
displayCommand: 'DSH_OXLINT_THREADS=4 pnpm run lint',
command: process.execPath,
args: ['/private/pnpm.cjs', 'exec', 'oxlint', '.', '--threads=4'],
env: { GOMAXPROCS: '4' },
args: ['/private/pnpm.cjs', 'run', 'lint'],
})
})
it('rejects a non-positive or non-integer worker bound', () => {
expect(() => withEnv('DSH_OXLINT_THREADS', 'auto', () =>
withPnpmEntrypoint(() => gatesForMode('ci-lint'))))
.toThrow('DSH_OXLINT_THREADS must be a positive integer')
})
})
describe('Node 24 consumer graph', () => {