Open History to see the last commit
1import { describe, expect, it } from 'vitest'
2import { buildSetupPlan } from '../src/setup-plan'
3
4describe('buildSetupPlan', () => {
5 it('records serial/parallel groups in call order', () => {
6 const plan = buildSetupPlan(({ serial, parallel }) => {
7 serial('pnpm install')
8 parallel(['pnpm build', 'pnpm typecheck'])
9 serial('echo done')
10 })
11 expect(plan).toEqual([
12 { kind: 'serial', command: 'pnpm install' },
13 { kind: 'parallel', commands: ['pnpm build', 'pnpm typecheck'] },
14 { kind: 'serial', command: 'echo done' },
15 ])
16 })
17 it('treats a string array as serial groups', () => {
18 expect(buildSetupPlan(['a', 'b'])).toEqual([
19 { kind: 'serial', command: 'a' },
20 { kind: 'serial', command: 'b' },
21 ])
22 })
23 it('returns [] for undefined', () => {
24 expect(buildSetupPlan(undefined)).toEqual([])
25 })
26})