Skip to content

Commit debf92f

Browse files
committed
refactor(sea, test): rename sea/binary → sea/util + fix git-extended timeouts
Two changes folded together in this commit: ──── 1. rename sea/binary.ts → sea/util.ts ──── Aligns the per-subdirectory file convention so both `src/sea/` and `src/smol/` use the same `util.ts` filename for the file containing "detection + accessor for the same concept": src/sea/util.ts — isSeaBinary + getSeaBinaryPath src/smol/util.ts — isSmol + getSmolUtil (+ SmolUtilBinding) Test moved: test/unit/sea/binary.test.mts → test/unit/sea/util.test.mts. Public import path: '@socketsecurity/lib/sea/binary' → '@socketsecurity/lib/sea/util' ──── 2. fix flaky git-extended test timeouts ──── The 13 tests inside `describe('real git operations')` in test/unit/git-extended.test.mts each do 4-15 `spawnSync('git', ...)` calls. Under CPU contention from the full-suite parallel run (~169 test files), individual git ops can take 5-10s, exceeding vitest's default 10s testTimeout and flaking. Bumps the describe-scope timeout to 30s via `vi.setConfig()`. No test logic changes — just gives slow git ops headroom under load. Verified: full suite now runs to completion (6669 tests green, 31 skipped, 169 files).
1 parent 5a72812 commit debf92f

5 files changed

Lines changed: 16 additions & 10 deletions

File tree

docs/api-index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ Each entry links to the source module and shows the first sentence of its `@file
225225

226226
## sea/
227227

228-
| Subpath | Description |
229-
| -------------------------------------------------------- | --------------------------------------------------------------------- |
230-
| [`@socketsecurity/lib/sea/binary`](../src/sea/binary.ts) | SEA (Single Executable Application) binary detection + path accessor. |
228+
| Subpath | Description |
229+
| ---------------------------------------------------- | --------------------------------------------------------------------- |
230+
| [`@socketsecurity/lib/sea/util`](../src/sea/util.ts) | SEA (Single Executable Application) binary detection + path accessor. |
231231

232232
## smol/
233233

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -639,9 +639,9 @@
639639
"types": "./dist/schema/validate.d.ts",
640640
"default": "./dist/schema/validate.js"
641641
},
642-
"./sea/binary": {
643-
"types": "./dist/sea/binary.d.ts",
644-
"default": "./dist/sea/binary.js"
642+
"./sea/util": {
643+
"types": "./dist/sea/util.d.ts",
644+
"default": "./dist/sea/util.js"
645645
},
646646
"./shadow": {
647647
"types": "./dist/shadow.d.ts",
File renamed without changes.

test/unit/git-extended.test.mts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
} from '@socketsecurity/lib/git'
3131
import { normalizePath } from '@socketsecurity/lib/paths/normalize'
3232
import { spawnSync } from '@socketsecurity/lib/spawn'
33-
import { describe, expect, it } from 'vitest'
33+
import { describe, expect, it, vi } from 'vitest'
3434
import { runWithTempDir } from './utils/temp-file-helper'
3535

3636
describe('git extended tests', () => {
@@ -201,7 +201,13 @@ describe('git extended tests', () => {
201201
})
202202

203203
describe('real git operations', () => {
204-
// Note: No need to save/restore cwd - we always use explicit cwd options
204+
// Note: No need to save/restore cwd - we always use explicit cwd options.
205+
//
206+
// Each test in this block does 4-15 spawnSync('git', ...) calls,
207+
// which legitimately takes 5-10s under CPU contention when the
208+
// full test suite runs in parallel. The default vitest 10s
209+
// timeout flakes these — bump describe-scope default to 30s.
210+
vi.setConfig({ testTimeout: 30_000, hookTimeout: 30_000 })
205211

206212
it('should work with a temporary git repository', async () => {
207213
await runWithTempDir(async tmpDir => {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
import { describe, expect, it } from 'vitest'
1313

14-
import { getSeaBinaryPath, isSeaBinary } from '@socketsecurity/lib/sea/binary'
14+
import { getSeaBinaryPath, isSeaBinary } from '@socketsecurity/lib/sea/util'
1515

16-
describe('sea/binary', () => {
16+
describe('sea/util', () => {
1717
describe('isSeaBinary', () => {
1818
it('should return boolean', () => {
1919
const result = isSeaBinary()

0 commit comments

Comments
 (0)