Enough calls for several batches of the pool's size, each file calling into its neighbours and its base class.
(root: string)
| 28 | |
| 29 | /** Enough calls for several batches of the pool's size, each file calling into its neighbours and its base class. */ |
| 30 | function writeProject(root: string): void { |
| 31 | fs.mkdirSync(path.join(root, 'src')); |
| 32 | const files = 12; |
| 33 | const methods = 60; |
| 34 | for (let f = 0; f < files; f++) { |
| 35 | const base = f === 0 ? '' : ` extends Service${f - 1}`; |
| 36 | const body: string[] = []; |
| 37 | for (let m = 0; m < methods; m++) { |
| 38 | const calls = Array.from({ length: 12 }, (_, c) => ` this.method${f}_${(m + c) % methods}();\n this.inherited${Math.max(0, f - 1)}();\n helper${(f + c) % files}();`); |
| 39 | body.push(` method${f}_${m}(): void {\n${calls.join('\n')}\n }`); |
| 40 | } |
| 41 | fs.writeFileSync(path.join(root, 'src', `service${f}.ts`), [ |
| 42 | ...(f === 0 ? [] : [`import { Service${f - 1} } from './service${f - 1}';`]), |
| 43 | ...Array.from({ length: files }, (_, i) => i).filter((i) => i !== f).map((i) => `import { helper${i} } from './service${i}';`), |
| 44 | `export function helper${f}(): void {}`, |
| 45 | `export class Service${f}${base} {`, |
| 46 | ` inherited${f}(): void {}`, |
| 47 | ...body, |
| 48 | '}', |
| 49 | '', |
| 50 | ].join('\n')); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | function indexedGraph(root: string, env: NodeJS.ProcessEnv): { graph: string; log: string } { |
| 55 | const result = spawnSync(process.execPath, [cli, 'init', '-y', root], { |
no test coverage detected