Skip to content

Commit 0df096b

Browse files
committed
Published using @Stream44 Studio
Signed-off-by: Christoph <christoph@christoph.diy>
1 parent 4572010 commit 0df096b

3 files changed

Lines changed: 58 additions & 3 deletions

File tree

bin/activate

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ export F_WORKSPACE_ACTIVATE_BIN_PATH="$_dir/activate"
3333
export F_WORKSPACE_IMPL_DIR="$(dirname $_dir)"
3434

3535
# Execute activate.ts from the same directory as this script
36-
eval "$($_dir/activate.ts)"
36+
"$_dir/activate.ts"

examples/01-Lifecycle/main.test.ts

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ describe('t44 lifecycle', function () {
106106
await writeFile(join(repoDir, '.workspace', 'workspace.yaml'), workspaceYaml)
107107
})
108108

109-
it('init — t44 info --yes initializes workspace', async () => {
109+
it('init --yes initializes workspace', async () => {
110110
const { exitCode, stdout, stderr } = await runT44('info')
111111

112112
if (exitCode !== 0) {
@@ -130,6 +130,61 @@ describe('t44 lifecycle', function () {
130130
expect(signingKeyStat.isFile()).toBe(true)
131131
}, 15_000)
132132

133+
it('activate — bin/activate.ts outputs shell exports', async () => {
134+
const activateBin = join(import.meta.dir, '../../bin/activate.ts')
135+
const proc = Bun.spawn([activateBin, '--yes'], {
136+
env,
137+
cwd: repoDir,
138+
stdout: 'pipe',
139+
stderr: 'pipe',
140+
stdin: 'pipe',
141+
})
142+
proc.stdin.end()
143+
144+
const timeout = setTimeout(() => proc.kill(), 15_000)
145+
146+
const stdoutChunks: string[] = []
147+
const stderrChunks: string[] = []
148+
149+
const verbose = !!process.env.VERBOSE
150+
151+
const stdoutReader = new WritableStream({
152+
write(chunk) {
153+
const text = new TextDecoder().decode(chunk)
154+
stdoutChunks.push(text)
155+
if (verbose) process.stdout.write(text)
156+
}
157+
})
158+
159+
const stderrReader = new WritableStream({
160+
write(chunk) {
161+
const text = new TextDecoder().decode(chunk)
162+
stderrChunks.push(text)
163+
if (verbose) process.stderr.write(text)
164+
}
165+
})
166+
167+
const [exitCode] = await Promise.all([
168+
proc.exited,
169+
proc.stdout.pipeTo(stdoutReader),
170+
proc.stderr.pipeTo(stderrReader),
171+
])
172+
173+
clearTimeout(timeout)
174+
175+
const stdout = stdoutChunks.join('')
176+
const stderr = stderrChunks.join('')
177+
178+
if (exitCode !== 0) {
179+
console.log('STDOUT:', stdout)
180+
console.log('STDERR:', stderr)
181+
}
182+
183+
expect(exitCode).toBe(0)
184+
expect(stdout.length).toBeGreaterThan(0)
185+
expect(stdout).toContain('export ')
186+
}, 15_000)
187+
133188
it('info — displays workspace information', async () => {
134189
const { exitCode, stdout, stderr } = await runT44('info', '--full')
135190

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "t44",
3-
"version": "0.4.0-rc.9",
3+
"version": "0.4.0-rc.10",
44
"license": "Apache-2.0",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)