Files
pnpm/building/during-install/test/buildSequence.test.ts
Zoltan Kochan 2fccb03fbe refactor: consolidate build-related packages into building/ domain (#10918)
* refactor: rename rebuildSelectedPkgs/rebuildProjects to buildSelectedPkgs/buildProjects

The "rebuild" prefix is redundant now that these functions live in
@pnpm/building.after-install.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: rename Rebuild option types to Build (RebuildOptions → BuildOptions, etc.)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: rename plugin-commands-rebuild and exec.build-commands to building domain

- @pnpm/plugin-commands-rebuild → @pnpm/building.build-commands
- @pnpm/exec.build-commands → @pnpm/building.policy-commands

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: move build-modules and pkg-requires-build to building domain

- @pnpm/build-modules → @pnpm/building.during-install
- @pnpm/exec.pkg-requires-build → @pnpm/building.pkg-requires-build

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style: alphabetically sort imports after package renames

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add changeset

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 10:56:13 +01:00

82 lines
1.5 KiB
TypeScript

import { buildSequence } from '../lib/buildSequence.js'
test('buildSequence() test 1', () => {
const chunks = buildSequence({
'/a/1.0.0': {
children: {
c: '/c/1.0.0',
},
requiresBuild: true,
},
'/b/1.0.0': {
children: {
c: '/c/1.0.0',
},
requiresBuild: true,
},
'/c/1.0.0': {
children: {},
requiresBuild: true,
},
}, ['/a/1.0.0', '/b/1.0.0'])
expect(chunks).toStrictEqual([
['/c/1.0.0'],
['/a/1.0.0', '/b/1.0.0'],
])
})
test('buildSequence() test 2', () => {
const chunks = buildSequence({
'/a/1.0.0': {
children: {
c: '/c/1.0.0',
},
requiresBuild: true,
},
'/b/1.0.0': {
children: {
c: '/c/1.0.0',
},
},
'/c/1.0.0': {
children: {},
requiresBuild: true,
},
}, ['/a/1.0.0', '/b/1.0.0'])
expect(chunks).toStrictEqual([
['/c/1.0.0'],
['/a/1.0.0'],
])
})
test('buildSequence() test 3', () => {
const chunks = buildSequence({
'/a/1.0.0': {
children: {
c: '/c/1.0.0',
},
requiresBuild: true,
},
'/b/1.0.0': {
children: {
d: '/d/1.0.0',
},
},
'/c/1.0.0': {
children: {},
requiresBuild: true,
},
'/d/1.0.0': {
children: {
c: '/c/1.0.0',
},
requiresBuild: true,
},
}, ['/a/1.0.0', '/b/1.0.0'])
expect(chunks).toStrictEqual([
['/c/1.0.0'],
['/a/1.0.0', '/d/1.0.0'],
['/b/1.0.0'],
])
})