Skip to content

Commit 5fe8319

Browse files
committed
fix(cli): skip update checks in test environments
- Wrap scheduleUpdateCheck in environment check for VITEST and CI - Prevents update manager warnings from polluting test snapshots - Fixes 200+ snapshot test failures in CI across all platforms The update manager was running in tests and printing warnings about failed cache directory creation, which were captured by snapshot tests and causing mismatches.
1 parent d64ef08 commit 5fe8319

File tree

6 files changed

+44
-26
lines changed

6 files changed

+44
-26
lines changed

.config/index.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Comprehensive index of all shared configuration files and documentation for the
44

55
## Quick Links
66

7-
- [Quick Reference](./QUICK_REFERENCE.md) - Copy-paste examples for common use cases
7+
- [Quick Reference](./quick-reference.md) - Copy-paste examples for common use cases
88
- [Usage Guide](./README.md) - Detailed usage documentation and examples
99
- [Architecture](../docs/shared-configuration-architecture.md) - Design principles and rationale
1010
- [Migration Guide](../docs/configuration-migration.md) - Step-by-step migration instructions
@@ -65,8 +65,8 @@ Comprehensive index of all shared configuration files and documentation for the
6565
| File | Lines | Purpose |
6666
|------|-------|---------|
6767
| `README.md` | 145 | Usage documentation with examples |
68-
| `QUICK_REFERENCE.md` | 280 | Quick copy-paste reference |
69-
| `INDEX.md` | This file | Index of all configuration files |
68+
| `quick-reference.md` | 280 | Quick copy-paste reference |
69+
| `index.md` | This file | Index of all configuration files |
7070

7171
### In docs/
7272

@@ -84,7 +84,7 @@ Comprehensive index of all shared configuration files and documentation for the
8484
2. Create `vitest.config.mts` merging base config
8585
3. No ESLint config needed (root config applies)
8686

87-
See: [Quick Reference](./QUICK_REFERENCE.md) for examples
87+
See: [Quick Reference](./quick-reference.md) for examples
8888

8989
### Existing Package Migration
9090

@@ -115,9 +115,9 @@ See: [README.md](./README.md) - "Vitest - Package Config"
115115

116116
```
117117
.config/
118-
├── INDEX.md # This file
118+
├── index.md # This file
119119
├── README.md # Usage guide
120-
├── QUICK_REFERENCE.md # Quick reference
120+
├── quick-reference.md # Quick reference
121121
├── tsconfig.base.json # Base TypeScript
122122
├── tsconfig.build.json # Build TypeScript
123123
├── tsconfig.test.json # Test TypeScript
@@ -200,7 +200,7 @@ docs/
200200

201201
### For Usage Questions
202202

203-
1. Check [Quick Reference](./QUICK_REFERENCE.md) for common patterns
203+
1. Check [Quick Reference](./quick-reference.md) for common patterns
204204
2. Review [README.md](./README.md) for detailed examples
205205
3. Compare with similar packages
206206

docs/builds-created.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ Created comprehensive, self-healing build infrastructure for Socket CLI with:
7171
- Verification steps
7272
- Common issues and fixes
7373

74-
9. **`docs/BUILD_QUICK_START.md`** (NEW - ~350 lines)
74+
9. **`docs/build-quick-start.md`** (NEW - ~350 lines)
7575
- Quick start guide
7676
- Common build scenarios
7777
- Output structure
7878
- Speed optimization tips
7979

80-
10. **`docs/BUILDS_CREATED.md`** (THIS FILE)
80+
10. **`docs/builds-created.md`** (THIS FILE)
8181
- Summary of what was built
8282
- Complete file list
8383
- Usage instructions

packages/cli/src/cli-entry.mts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,18 @@ const __filename = fileURLToPath(import.meta.url)
5252
void (async () => {
5353
const registryUrl = lookupRegistryUrl()
5454

55-
// Unified update notifier handles both SEA and npm automatically.
56-
await scheduleUpdateCheck({
57-
authInfo: lookupRegistryAuthToken(registryUrl, { recursive: true }),
58-
name: isSeaBinary()
59-
? SOCKET_CLI_BIN_NAME
60-
: ENV.INLINED_SOCKET_CLI_NAME || SOCKET_CLI_BIN_NAME,
61-
registryUrl,
62-
version: ENV.INLINED_SOCKET_CLI_VERSION || '0.0.0',
63-
})
55+
// Skip update checks in test environments.
56+
if (process.env['VITEST'] !== '1' && process.env['CI'] !== 'true') {
57+
// Unified update notifier handles both SEA and npm automatically.
58+
await scheduleUpdateCheck({
59+
authInfo: lookupRegistryAuthToken(registryUrl, { recursive: true }),
60+
name: isSeaBinary()
61+
? SOCKET_CLI_BIN_NAME
62+
: ENV.INLINED_SOCKET_CLI_NAME || SOCKET_CLI_BIN_NAME,
63+
registryUrl,
64+
version: ENV.INLINED_SOCKET_CLI_VERSION || '0.0.0',
65+
})
66+
}
6467

6568
try {
6669
await meowWithSubcommands(

packages/cli/test/helpers/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,12 +364,12 @@ pnpm run test test/helpers/example-usage.test.mts
364364

365365
## Migration Guide
366366

367-
See [EXAMPLES.md](./EXAMPLES.md) for detailed migration examples and before/after comparisons.
367+
See [examples.md](./examples.md) for detailed migration examples and before/after comparisons.
368368

369369
## API Documentation
370370

371371
Full API documentation with examples is available in:
372-
- [EXAMPLES.md](./EXAMPLES.md) - Comprehensive usage examples
372+
- [examples.md](./examples.md) - Comprehensive usage examples
373373
- Individual module files - JSDoc documentation
374374

375375
## Contributing
@@ -380,7 +380,7 @@ When adding new helpers:
380380
2. **Add JSDoc comments** - Document parameters and return types
381381
3. **Include examples** - Show usage in JSDoc
382382
4. **Write tests** - Add to `example-usage.test.mts`
383-
5. **Update EXAMPLES.md** - Add comprehensive examples
383+
5. **Update examples.md** - Add comprehensive examples
384384
6. **Export from index** - Add to `index.mts`
385385

386386
## License
@@ -390,6 +390,6 @@ Same as Socket CLI (MIT)
390390
## Support
391391

392392
For issues or questions:
393-
- Check [EXAMPLES.md](./EXAMPLES.md) for usage patterns
393+
- Check [examples.md](./examples.md) for usage patterns
394394
- Review existing tests in `test/` directory
395395
- Open an issue in the Socket CLI repository

packages/cli/test/helpers/sdk-testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,5 +992,5 @@ What are you testing?
992992
## See Also
993993

994994
- [README.md](./README.md) - CLI execution and workspace helpers
995-
- [EXAMPLES.md](./EXAMPLES.md) - Comprehensive examples
995+
- [examples.md](./examples.md) - Comprehensive examples
996996
- Individual helper files - JSDoc documentation

packages/onnx-runtime-builder/scripts/build.mjs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ import { fileURLToPath } from 'node:url'
1818
import { logger } from '@socketsecurity/lib/logger'
1919

2020
import { exec, execCapture } from '@socketsecurity/build-infra/lib/build-exec'
21+
import {
22+
printSetupResults,
23+
setupBuildEnvironment,
24+
} from '@socketsecurity/build-infra/lib/build-env'
2125
import { EmscriptenBuilder } from '@socketsecurity/build-infra/lib/emscripten-builder'
2226
import {
2327
checkCompiler,
@@ -279,9 +283,20 @@ async function main() {
279283
throw new Error('Python 3.8+ required')
280284
}
281285

282-
// Check for Emscripten.
283-
if (!process.env.EMSDK) {
284-
printError('Emscripten SDK not found', 'Set EMSDK environment variable')
286+
// Setup build environment (check for Emscripten SDK).
287+
const envSetup = await setupBuildEnvironment({
288+
emscripten: true,
289+
autoSetup: false,
290+
})
291+
292+
printSetupResults(envSetup)
293+
294+
if (!envSetup.success) {
295+
printError('')
296+
printError('Build environment setup failed')
297+
printError('Install Emscripten SDK:')
298+
printError(' https://emscripten.org/docs/getting_started/downloads.html')
299+
printError('')
285300
throw new Error('Emscripten SDK required')
286301
}
287302

0 commit comments

Comments
 (0)