mirror of
https://github.com/stablyai/orca.git
synced 2026-11-04 02:57:36 +00:00
* perf(lint): keep JS plugins out of default oxlint and adopt ast-grep Any jsPlugin makes Oxlint hand every file's AST to Node, so the seven custom plugins cost the default `oxlint` run several times its native time. - Move app-store-performance, quadratic-buffer-concat, renderer-scrollbar-style and ime-enter-guard (scope- or dataflow-aware) to config/oxlint-js-plugins.json, run by `pnpm lint:js-plugins`, CI, lint-staged and the changed-lines gate. - Port sort-comparator-performance, mobile-pairing and native-chat-design-tokens to ast-grep rules with rule tests, and delete the plugins. - Add @ast-grep/cli, config/sgconfig.yml, `pnpm lint:ast-grep` / `test:ast-grep`, a CI step, and an ast-grep pass in check-changed-code-quality. - Add flaky-test rules (wall-clock reads, real-time waits, polling loops, unquarantined skips, unexplained timeout bumps), baselined by a count ratchet. * Enforce flaky-test ratchet on changed files; refresh baseline * docs(agents): keep custom-rule details out of AGENTS.md * Resolve ast-grep from the repo so gate scans of other roots work
35 lines
1.2 KiB
JavaScript
35 lines
1.2 KiB
JavaScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { changedFileScope, countFindings } from './check-flaky-test-pattern-ratchet.mjs'
|
|
|
|
describe('countFindings', () => {
|
|
it('counts each rule per file, folding TSX twins and Windows separators', () => {
|
|
const counts = countFindings(
|
|
[
|
|
{ ruleId: 'test-no-wall-clock', file: 'src/a.test.ts' },
|
|
{ ruleId: 'test-no-wall-clock', file: 'src\\a.test.ts' },
|
|
{ ruleId: 'test-no-wall-clock-tsx', file: 'src/b.test.tsx' },
|
|
{ ruleId: 'test-no-real-time-wait', file: 'src/a.test.ts' },
|
|
{ ruleId: 'test-no-real-time-wait', file: 'scratch.test.ts' }
|
|
],
|
|
(file) => file !== 'scratch.test.ts'
|
|
)
|
|
|
|
expect([...counts]).toEqual([
|
|
['test-no-wall-clock:src/a.test.ts', 2],
|
|
['test-no-wall-clock:src/b.test.tsx', 1],
|
|
['test-no-real-time-wait:src/a.test.ts', 1]
|
|
])
|
|
})
|
|
})
|
|
|
|
describe('changedFileScope', () => {
|
|
it('limits enforcement to findings in changed files', () => {
|
|
const inScope = changedFileScope(new Set(['src/a.test.ts']))
|
|
|
|
expect(inScope('test-no-wall-clock:src/a.test.ts')).toBe(true)
|
|
expect(inScope('test-no-wall-clock:src/b.test.ts')).toBe(false)
|
|
expect(changedFileScope(null)).toBeUndefined()
|
|
})
|
|
})
|