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 packages/cli/test/cloud-login-json-ndjson.e2e.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -70,6 +70,7 @@ import { mkdtempSync, rmSync, readFileSync, existsSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
Expand DownExpand Up@@ -278,7 +279,7 @@ async function runCloudDeviceLogin(opts: {
'script',
// -q quiet, -e propagate the child's exit status, -c the command.
['-qec', shell, '/dev/null'],
{ env: { ...process.env, HOME: home, NO_COLOR: '1' }, maxBuffer: 32 * 1024 * 1024 },
{ env: childEnv({ HOME: home, NO_COLOR: '1' }), maxBuffer: 32 * 1024 * 1024 },
(err) => res(err ? Number((err as { code?: unknown }).code ?? 1) : 0),
);
});
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/test/generate-agent-retired.e2e.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,6 +37,7 @@ import { existsSync, mkdtempSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
Expand All@@ -56,7 +57,7 @@ function runTsx(args: string[], cwd: string): Promise<Run> {
execFile(
TSX,
args,
{ cwd, maxBuffer: 8 * 1024 * 1024, env: { ...process.env, NO_COLOR: '1' } },
{ cwd, maxBuffer: 8 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
resolvePromise({
// `err.code` is the real exit status; null/undefined means the child
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/test/generate-skill.e2e.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -81,6 +81,7 @@ import { tmpdir } from 'node:os';
import { dirname, join, matchesGlob, relative, resolve, sep } from 'node:path';
import { fileURLToPath } from 'node:url';
import { DEFAULT_METADATA_TYPE_REGISTRY } from '@objectstack/spec/kernel';
import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
Expand DownExpand Up@@ -114,7 +115,7 @@ function runTsx(args: string[], cwd: string): Promise<Run> {
execFile(
TSX,
args,
{ cwd, maxBuffer: 8 * 1024 * 1024, env: { ...process.env, NO_COLOR: '1' } },
{ cwd, maxBuffer: 8 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
resolvePromise({
// `err.code` is the real exit status; null/undefined means the child
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/test/hook-body-build-reach.e2e.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -51,6 +51,7 @@ import { mkdtempSync, rmSync, writeFileSync, readFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
Expand All@@ -67,7 +68,7 @@ function runCli(args: string[], cwd: string): Promise<Run> {
execFile(
TSX,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: { ...process.env, NO_COLOR: '1' } },
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
resolvePromise({
code: err ? (typeof (err as { code?: unknown }).code === 'number' ? (err as unknown as { code: number }).code : 1) : 0,
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/test/init-created-files-summary.e2e.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,6 +57,7 @@ import { mkdtempSync, rmSync, mkdirSync, writeFileSync, chmodSync, readdirSync }
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
Expand All@@ -75,7 +76,7 @@ function runCli(args: string[], cwd: string, env: Record<string, string>): Promi
execFile(
TSX,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: { ...process.env, NO_COLOR: '1', ...env } },
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1', ...env }) },
(err, stdout, stderr) => {
resolvePromise({
// The real exit status, not truthiness of `err` — a non-zero code
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/test/invocation-loudness.e2e.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -46,6 +46,7 @@ import { mkdtempSync, rmSync, symlinkSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const BIN = resolve(HERE, '../bin/run.js');
Expand All@@ -67,7 +68,7 @@ function runTsx(args: string[], cwd: string): Promise<Run> {
execFile(
TSX,
args,
{ cwd, maxBuffer: 8 * 1024 * 1024, env: { ...process.env, NO_COLOR: '1' } },
{ cwd, maxBuffer: 8 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
resolvePromise({
// `err.code` is the real exit status; null/undefined means the child
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/test/json-stdout-purity.e2e.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,6 +62,7 @@ import { mkdtempSync, rmSync, writeFileSync, readFileSync, readdirSync, statSync
import { tmpdir } from 'node:os';
import { join, resolve, relative, sep } from 'node:path';
import { fileURLToPath } from 'node:url';
import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
Expand DownExpand Up@@ -144,7 +145,7 @@ function runCli(argv: string[], cwd: string, env: Record<string, string>): Promi
execFile(
TSX,
[CLI, ...argv],
{ cwd, maxBuffer: 32 * 1024 * 1024, env: { ...process.env, NO_COLOR: '1', ...env } },
{ cwd, maxBuffer: 32 * 1024 * 1024, env: childEnv({ NO_COLOR: '1', ...env }) },
(err, stdout, stderr) => {
resolvePromise({
code: err ? (typeof (err as { code?: unknown }).code === 'number' ? (err as unknown as { code: number }).code : 1) : 0,
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/test/login-json-ndjson.e2e.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -66,6 +66,7 @@ import { mkdtempSync, rmSync, readFileSync, existsSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
Expand DownExpand Up@@ -267,7 +268,7 @@ async function runDeviceLogin(outcome: 'token' | 'access_denied'): Promise<Devic
'script',
// -q quiet, -e propagate the child's exit status, -c the command.
['-qec', shell, '/dev/null'],
{ env: { ...process.env, HOME: home, NO_COLOR: '1' }, maxBuffer: 32 * 1024 * 1024 },
{ env: childEnv({ HOME: home, NO_COLOR: '1' }), maxBuffer: 32 * 1024 * 1024 },
(err) => res(err ? Number((err as { code?: unknown }).code ?? 1) : 0),
);
});
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/test/login-json-noninteractive.e2e.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,6 +56,7 @@ import { mkdtempSync, rmSync, readFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
Expand DownExpand Up@@ -99,7 +100,7 @@ function runLogin(args: string[], answer: Array<{ when: RegExp; send: string }>
return new Promise<Run>((done) => {
const child = spawn(TSX, [CLI, 'login', ...args], {
stdio: ['pipe', 'pipe', 'pipe'],
env: { ...process.env, HOME: home, NO_COLOR: '1' },
env: childEnv({ HOME: home, NO_COLOR: '1' }),
});

let stdout = '';
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/test/migrate-exit-code.e2e.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,6 +36,7 @@ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
Expand DownExpand Up@@ -80,7 +81,7 @@ function runCli(args: string[], cwd: string, env: Record<string, string> = {}):
execFile(
TSX,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: { ...process.env, NO_COLOR: '1', ...env } },
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1', ...env }) },
(err, stdout, stderr) => {
resolvePromise({
// `err.code` is the real exit status; `null`/undefined means the
Expand Down
5 changes: 3 additions & 2 deletions packages/cli/test/migrate-meta.e2e.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,6 +23,7 @@ import { dirname, join, resolve } from 'node:path';
import { createRequire } from 'node:module';
import { fileURLToPath } from 'node:url';
import { ObjectStackDefinitionSchema } from '@objectstack/spec';
import { childEnv } from './helpers/serve-process.js';

const execFileP = promisify(execFile);
const HERE = resolve(fileURLToPath(import.meta.url), '..');
Expand DownExpand Up@@ -156,7 +157,7 @@ async function runMeta(args: string[], cwd: string) {
const { stdout } = await execFileP(TSX, [CLI, 'migrate', 'meta', ...args], {
cwd,
maxBuffer: 16 * 1024 * 1024,
env: { ...process.env, NO_COLOR: '1' },
env: childEnv({ NO_COLOR: '1' }),
});
return stdout;
}
Expand DownExpand Up@@ -431,7 +432,7 @@ export default defineStack({
await execFileP(TSX, [CLI, 'validate'], {
cwd: rkDir,
maxBuffer: 16 * 1024 * 1024,
env: { ...process.env, NO_COLOR: '1' },
env: childEnv({ NO_COLOR: '1' }),
});
} catch (e: any) {
refused = true;
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/test/qa-empty-glob-exit-code.e2e.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,6 +38,7 @@ import { mkdtempSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
Expand All@@ -60,7 +61,7 @@ function runCli(args: string[], cwd: string): Promise<Run> {
execFile(
TSX,
[CLI, ...args],
{ cwd, maxBuffer: 8 * 1024 * 1024, env: { ...process.env, NO_COLOR: '1' } },
{ cwd, maxBuffer: 8 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
resolvePromise({
// `err.code` is the real exit status; `null`/undefined means the child
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/test/validate-json-warning-parity.e2e.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,6 +62,7 @@ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
Expand DownExpand Up@@ -145,7 +146,7 @@ function runCli(args: string[], cwd: string): Promise<Run> {
execFile(
TSX,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: { ...process.env, NO_COLOR: '1' } },
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
resolvePromise({
code: err ? (typeof (err as { code?: unknown }).code === 'number' ? (err as unknown as { code: number }).code : 1) : 0,
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/test/validate-top-level-strict.e2e.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,6 +30,7 @@ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { childEnv } from './helpers/serve-process.js';

const HERE = resolve(fileURLToPath(import.meta.url), '..');
const CLI = resolve(HERE, '../bin/run-dev.js');
Expand DownExpand Up@@ -74,7 +75,7 @@ function runCli(args: string[], cwd: string): Promise<Run> {
execFile(
TSX,
[CLI, ...args],
{ cwd, maxBuffer: 16 * 1024 * 1024, env: { ...process.env, NO_COLOR: '1' } },
{ cwd, maxBuffer: 16 * 1024 * 1024, env: childEnv({ NO_COLOR: '1' }) },
(err, stdout, stderr) => {
resolvePromise({
code: err ? (typeof (err as { code?: unknown }).code === 'number' ? (err as unknown as { code: number }).code : 1) : 0,
Expand Down
16 changes: 1 addition & 15 deletions scripts/cli-test-child-env.baseline.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,21 +23,7 @@
"Sites that copy the whole environment ON PURPOSE do not belong here. They are DELIBERATE",
"entries in the gate itself, carrying their reason, and they are pinned in both directions."
],
"packages/cli/test/cloud-login-json-ndjson.e2e.test.ts": 1,
"packages/cli/test/generate-agent-retired.e2e.test.ts": 1,
"packages/cli/test/generate-skill.e2e.test.ts": 1,
"packages/cli/test/hook-body-build-reach.e2e.test.ts": 1,
"packages/cli/test/init-created-files-summary.e2e.test.ts": 1,
"packages/cli/test/invocation-loudness.e2e.test.ts": 1,
"packages/cli/test/json-stdout-purity.e2e.test.ts": 1,
"packages/cli/test/login-json-ndjson.e2e.test.ts": 1,
"packages/cli/test/login-json-noninteractive.e2e.test.ts": 1,
"packages/cli/test/migrate-exit-code.e2e.test.ts": 1,
"packages/cli/test/migrate-meta.e2e.test.ts": 2,
"packages/cli/test/qa-empty-glob-exit-code.e2e.test.ts": 1,
"packages/cli/test/serve-app-anchored-optional-import.e2e.test.ts": 1,
"packages/cli/test/serve-app-runtime-hooks.e2e.test.ts": 1,
"packages/cli/test/serve-host-fallback-base.e2e.test.ts": 1,
"packages/cli/test/validate-json-warning-parity.e2e.test.ts": 1,
"packages/cli/test/validate-top-level-strict.e2e.test.ts": 1
"packages/cli/test/serve-host-fallback-base.e2e.test.ts": 1
}
Loading