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
2 changes: 1 addition & 1 deletion .claude/skills/bump-coana/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ missing. Read [the pin and snapshot notes](references/pin-and-snapshots.md).
2. Refresh the native help snapshots:

```sh
node scripts/test/swap-snapshot-version.mts \
node scripts/refresh/snapshots/swap-version.mts \
--dep coana --from "$CURRENT_VERSION"
```

Expand Down
4 changes: 2 additions & 2 deletions .claude/skills/bump-coana/references/pin-and-snapshots.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

- The pinned version is `COANA_CLI_VERSION` in `src/constants.mts`.
- The native CLI snapshots that print this version are listed under `coana` in
`scripts/test/snapshot-dependencies.mts`. The checked-in files are the fix,
`scripts/refresh/snapshots/dependencies.mts`. The checked-in files are the fix,
scan-create, and scan-reach help snapshots.
- Use `node scripts/test/swap-snapshot-version.mts --dep coana --from <old>` to
- Use `node scripts/refresh/snapshots/swap-version.mts --dep coana --from <old>` to
preserve the terminal row width without a native build. If it refuses the
change, regenerate with `pnpm snapshots:update:dep coana` on a built native
CLI.
Expand Down
2 changes: 1 addition & 1 deletion .claude/skills/bump-socket-patch/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Take the exact released version as `$ARGUMENTS`. Ask for it if missing. Read
3. Refresh the native version screenshot without rebuilding:

```sh
node scripts/test/swap-snapshot-version.mts --dep socket-patch --from <old-version>
node scripts/refresh/snapshots/swap-version.mts --dep socket-patch --from <old-version>
```

If the helper reports no matching version or insufficient row space, use
Expand Down
2 changes: 1 addition & 1 deletion .claude/skills/bump-socket-patch/references/pin-and-sea.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- The source pin is `dependencies.@socketsecurity/socket-patch` in
`package.json`; pnpm records the resolved package and platform variants in
`pnpm-lock.yaml`.
- `scripts/test/snapshot-dependencies.mts` lists the native help snapshots and
- `scripts/refresh/snapshots/dependencies.mts` lists the terminal help snapshots and
the version snapshot. The version snapshot is the one that changes with a
package version bump.
- `src/sea/build-sea.mts` reads the exact package version, verifies installed
Expand Down
15 changes: 15 additions & 0 deletions .config/snapshot-path.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import path from 'node:path'
import { fileURLToPath } from 'node:url'

const root = fileURLToPath(new URL('../', import.meta.url))

export function resolveSnapshotPath(
testPath: string,
extension: string,
): string {
return path.join(
root,
'test/snapshots/vite',
path.relative(root, testPath) + extension,
)
}
1 change: 1 addition & 0 deletions .config/tsconfig.scripts.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"../scripts/*.mts",
"../scripts/lib/**/*.mts",
"../scripts/setup/**/*.mts",
"../scripts/refresh/**/*.mts",
"../scripts/test/**/*.mts",
"../src/sea/version.mts"
],
Expand Down
10 changes: 7 additions & 3 deletions .config/vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import { fileURLToPath } from 'node:url'

import { defineConfig } from 'vitest/config'

import { resolveSnapshotPath } from './snapshot-path.mts'

export default defineConfig({
root: fileURLToPath(new URL('../', import.meta.url)),
resolve: {
preserveSymlinks: false,
},
test: {
resolveSnapshotPath,
// Keep the package unit lane scoped to this CLI. The checkout also contains
// ignored upstream repositories and fleet tooling with independent deps and
// Vitest configs; those are exercised by their own workflows.
Expand All @@ -21,6 +24,7 @@ export default defineConfig({
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*',
// Exclude E2E tests from regular test runs.
'**/*.e2e.test.mts',
'test/e2e/**',
// Process-level CLI tests run in the serialized integration lane.
'**/*.integration.test.mts',
'src/commands/cli.test.mts',
Expand All @@ -29,9 +33,9 @@ export default defineConfig({
// Native process tests require the explicitly built SEA artifact.
'**/*.native.test.mts',
// Termless requires Node 23.6+; these focused UI captures run in the Node 26 lane.
'test/unit/lib/terminal/animation.test.mts',
'test/unit/utils/self-update.terminal.test.mts',
'test/unit/lib/optimize-svg.test.mts',
'test/unit/lib/termless/animation.test.mts',
'test/termless/**',
'test/unit/lib/termless/svgo.test.mts',
'test/unit/lib/native/cli-harness.test.mts',
// Exclude test fixtures — directories like test/fixtures/commands/optimize/pnpm{8,9}/
// contain full repo copies populated by `socket optimize` runs; their .test.mts
Expand Down
3 changes: 3 additions & 0 deletions .config/vitest.e2e.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import { fileURLToPath } from 'node:url'

import { defineConfig } from 'vitest/config'

import { resolveSnapshotPath } from './snapshot-path.mts'

export default defineConfig({
root: fileURLToPath(new URL('../', import.meta.url)),
resolve: {
preserveSymlinks: false,
},
test: {
resolveSnapshotPath,
// Serialize test files to prevent concurrent npx --force invocations
// from racing on the npm _npx cache directory.
fileParallelism: false,
Expand Down
3 changes: 3 additions & 0 deletions .config/vitest.integration.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import { fileURLToPath } from 'node:url'

import { defineConfig } from 'vitest/config'

import { resolveSnapshotPath } from './snapshot-path.mts'

export default defineConfig({
root: fileURLToPath(new URL('../', import.meta.url)),
resolve: {
preserveSymlinks: false,
},
test: {
resolveSnapshotPath,
// CLI integration tests may exercise npm exec/npx and pnpm dlx. Keep files
// serial so they never mutate the same package-manager cache concurrently.
fileParallelism: false,
Expand Down
3 changes: 3 additions & 0 deletions .config/vitest.native.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import { fileURLToPath } from 'node:url'

import { defineConfig } from 'vitest/config'

import { resolveSnapshotPath } from './snapshot-path.mts'

export default defineConfig({
root: fileURLToPath(new URL('../', import.meta.url)),
resolve: {
preserveSymlinks: false,
},
test: {
resolveSnapshotPath,
// These tests run a native executable and may invoke npm exec/npx or pnpm
// dlx. Serialize files to protect both package managers' shared caches.
fileParallelism: false,
Expand Down
15 changes: 11 additions & 4 deletions .config/vitest.terminal.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@ import { fileURLToPath } from 'node:url'

import { defineConfig } from 'vitest/config'

import { resolveSnapshotPath } from './snapshot-path.mts'

export default defineConfig({
root: fileURLToPath(new URL('../', import.meta.url)),
resolve: { preserveSymlinks: false },
test: {
resolveSnapshotPath,
env: process.argv.some(arg => arg === '--update' || arg === '-u')
? { SOCKET_CLI_NATIVE_TEST_UPDATE_SNAPSHOTS: 'true' }
: {},
include: [
'test/unit/lib/terminal/animation.test.mts',
'test/unit/utils/self-update.terminal.test.mts',
'test/unit/lib/terminal/output.test.mts',
'test/unit/lib/optimize-svg.test.mts',
'test/e2e/termless.test.mts',
'test/termless/**/*.test.mts',
'test/unit/lib/native/cli-harness.test.mts',
'test/unit/lib/terminal/output.test.mts',
'test/unit/lib/termless/animation.test.mts',
'test/unit/lib/termless/svgo.test.mts',
],
exclude: ['**/node_modules/**', '**/dist/**', '.claude/worktrees/**'],
},
Expand Down
4 changes: 0 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
* text=auto eol=lfs

# Generated terminal image baselines are reviewed through the screenshot report.
test/native-snapshots/**/*.svg binary linguist-generated=true
test/native-snapshots/**/*.png binary linguist-generated=true
152 changes: 5 additions & 147 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
!/scripts/babel/
!/scripts/ci/
!/scripts/lib/
!/scripts/refresh/
!/scripts/refresh/**
!/scripts/release/
!/scripts/rollup/
!/scripts/setup/
!/scripts/test/
!/scripts/test/terminal-report.mts
!/scripts/test/snapshots.mts
!/scripts/test/snapshot-dependencies.mts
!/scripts/test/swap-snapshot-version.mts
!/scripts/utils/
!/shadow-bin/
!/src/
Expand Down Expand Up @@ -216,6 +216,9 @@
!/src/utils/telemetry/
!/src/vendor/
!/test/
!/test/**

!/.claude/skills/bump-coana/SKILL.md
!/test/native/
!/test/native/commands/
!/test/native/commands/cli.native.test.mts
Expand Down Expand Up @@ -261,8 +264,6 @@
!/test/native-snapshots/
!/test/native-snapshots/**
!/test/unit/scripts/test/snapshots.test.mts
!/test/unit/scripts/test/snapshot-dependencies.test.mts
!/test/unit/scripts/test/swap-snapshot-version.test.mts
!/test/package-matrix.test.mts
!/test/fixtures/
!/test/fixtures/commands/
Expand Down Expand Up @@ -1193,7 +1194,6 @@
!/src/utils/sdk.mts
!/src/utils/sdk.test.mts
!/src/utils/self-update.mts
!/test/unit/utils/self-update.test.mts
!/src/utils/semver.mts
!/src/utils/serialize-result-json.mts
!/src/utils/shadow-links.mts
Expand Down Expand Up @@ -1225,148 +1225,6 @@
!/src/vendor/coana-cache.mjs
!/src/yarn-cli.mts
!/taze.config.mts
!/test/blessed-node24-strict.test.mts
!/test/dist-runtime-requires.test.mts
!/test/external-bare-requires.test.mts
!/test/fixtures/commands/cdxgen/package.json
!/test/fixtures/commands/fix/e2e-test-js/package-lock.json
!/test/fixtures/commands/fix/e2e-test-js/package.json
!/test/fixtures/commands/fix/e2e-test-multipm/npm-app/package-lock.json
!/test/fixtures/commands/fix/e2e-test-multipm/npm-app/package.json
!/test/fixtures/commands/fix/e2e-test-multipm/pnpm-app/package.json
!/test/fixtures/commands/fix/e2e-test-multipm/pnpm-app/pnpm-lock.yaml
!/test/fixtures/commands/fix/e2e-test-py/requirements.txt
!/test/fixtures/commands/fix/npm/monorepo/package-lock.json
!/test/fixtures/commands/fix/npm/monorepo/package.json
!/test/fixtures/commands/fix/npm/monorepo/packages/app/package.json
!/test/fixtures/commands/fix/npm/monorepo/packages/lib/package.json
!/test/fixtures/commands/fix/npm/vulnerable-deps/package-lock.json
!/test/fixtures/commands/fix/npm/vulnerable-deps/package.json
!/test/fixtures/commands/fix/pnpm/monorepo/package.json
!/test/fixtures/commands/fix/pnpm/monorepo/packages/app/package.json
!/test/fixtures/commands/fix/pnpm/monorepo/packages/lib/package.json
!/test/fixtures/commands/fix/pnpm/monorepo/pnpm-lock.yaml
!/test/fixtures/commands/fix/pnpm/vulnerable-deps/package.json
!/test/fixtures/commands/fix/pnpm/vulnerable-deps/pnpm-lock.yaml
!/test/fixtures/commands/fix/yarn/monorepo/package.json
!/test/fixtures/commands/fix/yarn/monorepo/packages/app/package.json
!/test/fixtures/commands/fix/yarn/monorepo/packages/lib/package.json
!/test/fixtures/commands/fix/yarn/monorepo/yarn.lock
!/test/fixtures/commands/fix/yarn/vulnerable-deps/package.json
!/test/fixtures/commands/fix/yarn/vulnerable-deps/yarn.lock
!/test/fixtures/commands/json/socket.json
!/test/fixtures/commands/manifest/conda/environment.yml
!/test/fixtures/commands/manifest/dynamic-sbom-inference/monorepo/dual-marker-dir/build.gradle
!/test/fixtures/commands/manifest/dynamic-sbom-inference/monorepo/dual-marker-dir/pom.xml
!/test/fixtures/commands/manifest/dynamic-sbom-inference/monorepo/reactor/moduleA/nested-gradle/build.gradle
!/test/fixtures/commands/manifest/dynamic-sbom-inference/monorepo/reactor/moduleA/pom.xml
!/test/fixtures/commands/manifest/dynamic-sbom-inference/monorepo/reactor/moduleB/independent-submodule/pom.xml
!/test/fixtures/commands/manifest/dynamic-sbom-inference/monorepo/reactor/moduleB/pom.xml
!/test/fixtures/commands/manifest/dynamic-sbom-inference/monorepo/reactor/pom.xml
!/test/fixtures/commands/manifest/dynamic-sbom-inference/monorepo/standalone-gradle/build.gradle.kts
!/test/fixtures/commands/manifest/dynamic-sbom-inference/monorepo/standalone-gradle/settings.gradle.kts
!/test/fixtures/commands/manifest/dynamic-sbom-inference/pom-names/app-dev.pom.xml
!/test/fixtures/commands/manifest/dynamic-sbom-inference/pom-names/bare/pom
!/test/fixtures/commands/manifest/dynamic-sbom-inference/pom-names/other.pom.xml
!/test/fixtures/commands/manifest/dynamic-sbom-inference/pom-names/pom.xml
!/test/fixtures/commands/manifest/dynamic-sbom-inference/pom-names/pom.xml.bak
!/test/fixtures/commands/manifest/dynamic-sbom-inference/pom-names/upper/POM.XML
!/test/fixtures/commands/manifest/dynamic-sbom-inference/pom-names/vendored/lib-1.0.pom
!/test/fixtures/commands/manifest/python/requirements.txt
!/test/fixtures/commands/npm/lacking-typosquat/package-lock.json
!/test/fixtures/commands/npm/lacking-typosquat/package.json
!/test/fixtures/commands/npm/npm10/package-lock.json
!/test/fixtures/commands/npm/npm10/package.json
!/test/fixtures/commands/npm/npm11/package-lock.json
!/test/fixtures/commands/npm/npm11/package.json
!/test/fixtures/commands/npm/npm9/package-lock.json
!/test/fixtures/commands/npm/npm9/package.json
!/test/fixtures/commands/optimize/npm/package-lock.json
!/test/fixtures/commands/optimize/npm/package.json
!/test/fixtures/commands/optimize/pnpm/package.json
!/test/fixtures/commands/optimize/pnpm/pnpm-lock.yaml
!/test/fixtures/commands/optimize/pnpm8/package.json
!/test/fixtures/commands/optimize/pnpm8/pnpm-lock.yaml
!/test/fixtures/commands/optimize/pnpm9/package.json
!/test/fixtures/commands/optimize/pnpm9/pnpm-lock.yaml
!/test/fixtures/commands/optimize/yarn/package.json
!/test/fixtures/commands/optimize/yarn/yarn.lock
!/test/fixtures/commands/patch/npm/.socket/blobs/76682a9fc3bbe62975176e2541f39a8168877d828d5cad8b56461fc36ac2b856
!/test/fixtures/commands/patch/npm/.socket/manifest.json
!/test/fixtures/commands/patch/npm/package-lock.json
!/test/fixtures/commands/patch/npm/package.json
!/test/fixtures/commands/patch/pnpm/.socket/blobs/76682a9fc3bbe62975176e2541f39a8168877d828d5cad8b56461fc36ac2b856
!/test/fixtures/commands/patch/pnpm/.socket/manifest.json
!/test/fixtures/commands/patch/pnpm/package.json
!/test/fixtures/commands/patch/pnpm/pnpm-lock.yaml
!/test/fixtures/commands/patch/yarn/.socket/blobs/76682a9fc3bbe62975176e2541f39a8168877d828d5cad8b56461fc36ac2b856
!/test/fixtures/commands/patch/yarn/.socket/manifest.json
!/test/fixtures/commands/patch/yarn/package.json
!/test/fixtures/commands/patch/yarn/yarn.lock
!/test/fixtures/commands/scan/npm-test-workspace-mono/.gitignore
!/test/fixtures/commands/scan/npm-test-workspace-mono/package-lock.json
!/test/fixtures/commands/scan/npm-test-workspace-mono/package.json
!/test/fixtures/commands/scan/npm-test-workspace-mono/packages/package-a/package.json
!/test/fixtures/commands/scan/npm-test-workspace-mono/packages/package-b/index.js
!/test/fixtures/commands/scan/npm-test-workspace-mono/packages/package-b/package.json
!/test/fixtures/commands/scan/plain-requirements-txt/requirements.txt
!/test/fixtures/commands/scan/simple-npm/index.js
!/test/fixtures/commands/scan/simple-npm/package.json
!/test/fixtures/commands/scan/uv-workspace/packages/api/pyproject.toml
!/test/fixtures/commands/scan/uv-workspace/packages/other/pyproject.toml
!/test/fixtures/commands/scan/uv-workspace/packages/shared/pyproject.toml
!/test/fixtures/commands/scan/uv-workspace/pyproject.toml
!/test/fixtures/commands/scan/uv-workspace/uv.lock
!/test/fixtures/manifest-bazel/bzlmod-only/MODULE.bazel
!/test/fixtures/manifest-bazel/custom-name-bzlmod/MODULE.bazel
!/test/fixtures/manifest-bazel/legacy-only/WORKSPACE
!/test/fixtures/manifest-bazel/legacy-with-load/WORKSPACE
!/test/fixtures/manifest-bazel/legacy-with-load/maven_deps.bzl
!/test/fixtures/manifest-bazel/migration/MODULE.bazel
!/test/fixtures/manifest-bazel/migration/WORKSPACE
!/test/fixtures/manifest-bazel/multi-repo-bzlmod/MODULE.bazel
!/test/fixtures/manifest-bazel/native/bzlmod/.bazelversion
!/test/fixtures/manifest-bazel/native/bzlmod/BUILD.bazel
!/test/fixtures/manifest-bazel/native/bzlmod/MODULE.bazel
!/test/fixtures/manifest-bazel/native/maven.expected.json
!/test/fixtures/manifest-bazel/native/workspace/.bazelversion
!/test/fixtures/manifest-bazel/native/workspace/BUILD.bazel
!/test/fixtures/manifest-bazel/native/workspace/WORKSPACE
!/test/fixtures/manifest-bazel/python-pypi/requirements.expected.txt
!/test/glob.test.mts
!/test/json-output-validation.mts
!/test/manifest-reachability-assertions.test.mts
!/test/maven-compat-smoke-assertions.test.mts
!/test/mock-auth.mts
!/test/mock-auth.test.mts
!/test/mock-malware-api.mts
!/test/mock-malware-api.test.mts
!/test/package-environment.npm-version.test.mts
!/test/pin-readme-assets.test.mts
!/test/reachability-options.mts
!/test/release-add-unreleased.test.mts
!/test/release-availability.test.mts
!/test/release-approve-npm.test.mts
!/test/release-artifact-download.test.mts
!/test/release-prepare.test.mts
!/test/release-history.test.mts
!/test/release-open-pr.test.mts
!/test/release-npm-policy.test.mts
!/test/release-registry.test.mts
!/test/release-version.test.mts
!/test/release-workflow.test.mts
!/test/run-with-config.mts
!/test/script-run-main.test.mts
!/test/script-scope.test.mts
!/test/script-update.test.mts
!/test/setup-node.test.mts
!/test/setup-uv.test.mts
!/test/smoke.sh
!/test/upload-artifact.test.mts
!/test/unit/scripts/test/apple-signing.test.mts
!/test/utils.mts
!/test/utils.test.mts
!/test/workflow-actions.test.mts
!/translations.json
!/tsconfig.json

Expand Down
Loading
Loading