Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion challenges/vibe-coding-mad-libs/install
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
# versions boothstrap's Pi uses, into this package's node_modules.
set -eu

package_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
# pwd -P resolves symlinks: npm ci fails on a --prefix that isn't a real path.
package_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)
npm ci --ignore-scripts --no-audit --no-fund --prefix "$package_dir"
9 changes: 6 additions & 3 deletions test/vibe-coding-mad-libs.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import assert from 'node:assert/strict'
import { spawn } from 'node:child_process'
import { cp, link, mkdtemp, readFile, rm, stat, writeFile } from 'node:fs/promises'
import { cp, link, mkdtemp, readFile, rm, stat, symlink, writeFile } from 'node:fs/promises'
import { createServer, get } from 'node:http'
import { tmpdir } from 'node:os'
import path from 'node:path'
Expand Down Expand Up @@ -211,10 +211,13 @@ for (const { name, text, finished } of finishedPromptCases) {
})
}

test('loads the extension under the pinned Pi packages after install', { timeout: installTimeoutMilliseconds + 60_000 }, async (context) => {
test('loads the extension under the pinned Pi packages after install through a symlink', { timeout: installTimeoutMilliseconds + 60_000 }, async (context) => {
const installedPackage = path.join(await makeTemporaryDirectory(context), 'package')
await cp(packageDirectory, installedPackage, { recursive: true, filter: (source) => path.basename(source) !== 'node_modules' })
const installed = await runExecutable(path.join(installedPackage, 'install'), [], { timeout: installTimeoutMilliseconds })
// A station can reach its package through a symlink, as macOS's /tmp is one.
const linkedPackage = path.join(await makeTemporaryDirectory(context), 'linked-package')
await symlink(installedPackage, linkedPackage)
const installed = await runExecutable(path.join(linkedPackage, 'install'), [], { timeout: installTimeoutMilliseconds })
assert.equal(installed.code, 0, installed.stderr)
const projectDirectory = await makeTemporaryDirectory(context)
const agentDirectory = await makeTemporaryDirectory(context)
Expand Down
Loading