Skip to content

Commit 66906c8

Browse files
committed
fix(e2e): check JS binary existence before running tests
- JS binary requires build (pnpm run build) before e2e tests - Added existence check for js binary type with helpful error message - All binary types (js, sea, smol) now validated before test execution
1 parent a05cd93 commit 66906c8

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

packages/cli/.env.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
NODE_COMPILE_CACHE="./.cache"
22
NODE_OPTIONS="--max-old-space-size=2048 --unhandled-rejections=warn"
33
VITEST=1
4-
# Points to local @socketsecurity/cli JS dist so stub binary doesn't download from npm
5-
SOCKET_CLI_JS_PATH="./dist/cli.js"
64
# Disable Node.js binary forwarding for tests
75
SOCKET_CLI_DISABLE_NODE_FORWARDING=1
6+
# Points to local @socketsecurity/cli JS dist so stub binary doesn't download from npm
7+
SOCKET_CLI_JS_PATH="./dist/cli.js"
88
# E2E test configuration
99
# Set to 1 to enable E2E tests (requires Socket API token)
1010
# RUN_E2E_TESTS=1

packages/cli/scripts/e2e.mjs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,17 @@ const BINARY_FLAGS = {
4545
}
4646

4747
async function checkBinaryExists(binaryType) {
48-
// JS binary always exists after build.
49-
if (binaryType === 'js') {
50-
return true
51-
}
52-
53-
// For explicit binary requests (sea, smol), require binary to exist.
54-
if (binaryType === 'sea' || binaryType === 'smol') {
48+
// For explicit binary requests (js, sea, smol), require binary to exist.
49+
if (binaryType === 'js' || binaryType === 'sea' || binaryType === 'smol') {
5550
const binaryPath = BINARY_PATHS[binaryType]
5651
if (!existsSync(binaryPath)) {
5752
logger.error(`${colors.red('✗')} Binary not found: ${binaryPath}`)
5853
logger.log('')
5954
logger.log('The binary must be built before running e2e tests.')
6055
logger.log('Build commands:')
61-
if (binaryType === 'sea') {
56+
if (binaryType === 'js') {
57+
logger.log(' pnpm run build')
58+
} else if (binaryType === 'sea') {
6259
logger.log(' pnpm --filter @socketbin/node-sea-builder run build')
6360
} else if (binaryType === 'smol') {
6461
logger.log(' pnpm --filter @socketbin/node-smol-builder run build')

0 commit comments

Comments
 (0)