Index `files`, counting how often the whole project's text was read for a flow.
(files: Record<string, string>)
| 399 | |
| 400 | /** Index `files`, counting how often the whole project's text was read for a flow. */ |
| 401 | async function wholeProjectReads(files: Record<string, string>): Promise<number> { |
| 402 | let reads = 0; |
| 403 | const adapter = rubyParameterFlow.adapter.bind(rubyParameterFlow); |
| 404 | vi.spyOn(rubyParameterFlow, 'adapter').mockImplementation((...args) => { |
| 405 | const made = adapter(...args); |
| 406 | const written = made.written.bind(made); |
| 407 | made.written = (names, files) => { |
| 408 | reads++; |
| 409 | return written(names, files); |
| 410 | }; |
| 411 | return made; |
| 412 | }); |
| 413 | await indexed(files); |
| 414 | return reads; |
| 415 | } |
| 416 | |
| 417 | it('reads the whole project only when a flow would change something', async () => { |
| 418 | expect(await wholeProjectReads(BASE)).toBe(1); |
no test coverage detected