diff --git a/.claude/skills/bump-coana/SKILL.md b/.claude/skills/bump-coana/SKILL.md index 5f944168b..756de67a0 100644 --- a/.claude/skills/bump-coana/SKILL.md +++ b/.claude/skills/bump-coana/SKILL.md @@ -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" ``` diff --git a/.claude/skills/bump-coana/references/pin-and-snapshots.md b/.claude/skills/bump-coana/references/pin-and-snapshots.md index 4ce3f756b..14987707a 100644 --- a/.claude/skills/bump-coana/references/pin-and-snapshots.md +++ b/.claude/skills/bump-coana/references/pin-and-snapshots.md @@ -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 ` to +- Use `node scripts/refresh/snapshots/swap-version.mts --dep coana --from ` 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. diff --git a/.claude/skills/bump-socket-patch/SKILL.md b/.claude/skills/bump-socket-patch/SKILL.md index b12efd151..9eeada886 100644 --- a/.claude/skills/bump-socket-patch/SKILL.md +++ b/.claude/skills/bump-socket-patch/SKILL.md @@ -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 + node scripts/refresh/snapshots/swap-version.mts --dep socket-patch --from ``` If the helper reports no matching version or insufficient row space, use diff --git a/.claude/skills/bump-socket-patch/references/pin-and-sea.md b/.claude/skills/bump-socket-patch/references/pin-and-sea.md index b08b14509..8ba228e9b 100644 --- a/.claude/skills/bump-socket-patch/references/pin-and-sea.md +++ b/.claude/skills/bump-socket-patch/references/pin-and-sea.md @@ -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 diff --git a/.config/snapshot-path.mts b/.config/snapshot-path.mts new file mode 100644 index 000000000..3c4f63a00 --- /dev/null +++ b/.config/snapshot-path.mts @@ -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, + ) +} diff --git a/.config/tsconfig.scripts.json b/.config/tsconfig.scripts.json index 103a00d3a..486698d28 100644 --- a/.config/tsconfig.scripts.json +++ b/.config/tsconfig.scripts.json @@ -16,6 +16,7 @@ "../scripts/*.mts", "../scripts/lib/**/*.mts", "../scripts/setup/**/*.mts", + "../scripts/refresh/**/*.mts", "../scripts/test/**/*.mts", "../src/sea/version.mts" ], diff --git a/.config/vitest.config.mts b/.config/vitest.config.mts index cbb627ec5..eefa13d63 100644 --- a/.config/vitest.config.mts +++ b/.config/vitest.config.mts @@ -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. @@ -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', @@ -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 diff --git a/.config/vitest.e2e.config.mts b/.config/vitest.e2e.config.mts index 5c4c891b8..0ed28d4b0 100644 --- a/.config/vitest.e2e.config.mts +++ b/.config/vitest.e2e.config.mts @@ -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, diff --git a/.config/vitest.integration.config.mts b/.config/vitest.integration.config.mts index 3449bdd82..5b37d0861 100644 --- a/.config/vitest.integration.config.mts +++ b/.config/vitest.integration.config.mts @@ -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, diff --git a/.config/vitest.native.config.mts b/.config/vitest.native.config.mts index 00fa81978..994807a1a 100644 --- a/.config/vitest.native.config.mts +++ b/.config/vitest.native.config.mts @@ -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, diff --git a/.config/vitest.terminal.config.mts b/.config/vitest.terminal.config.mts index 71d38c3c2..3e04d8a35 100644 --- a/.config/vitest.terminal.config.mts +++ b/.config/vitest.terminal.config.mts @@ -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/**'], }, diff --git a/.gitattributes b/.gitattributes index 409688ea3..af7d217f6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore index 3bee437a1..8505f5a9c 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ @@ -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 @@ -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/ @@ -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 @@ -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 diff --git a/eslint.config.js b/eslint.config.js index fec4727fa..4f2d9193a 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -217,6 +217,7 @@ module.exports = [ // Allow configs. '*.config.mts', '.config/*.config.mts', + '.config/snapshot-path.mts', '.github/actions/repo/cache-downloads/*.mts', // Allow paths like src/utils/*.test.mts. 'src/*/*.test.mts', @@ -228,22 +229,29 @@ module.exports = [ 'test/*.mts', 'test/src/utils/*.test.mts', 'test/src/commands/logout/*.test.mts', + 'test/e2e/*.test.mts', + 'test/termless/utils/*.test.mts', 'test/unit/utils/*.test.mts', 'test/unit/github/actions/repo/cache-downloads/*.test.mts', 'test/lib/native/*.mts', - 'test/lib/optimize-svg.mts', 'test/lib/terminal/*.mts', + 'test/lib/termless/*.mts', 'test/unit/lib/*.test.mts', 'test/unit/lib/native/*.test.mts', 'test/unit/lib/terminal/*.test.mts', + 'test/unit/lib/termless/*.test.mts', 'test/unit/sea/*.test.mts', 'test/unit/sea/build/*.test.mts', 'test/native/commands/*.native.test.mts', 'test/unit/scripts/test/*.test.mts', + 'test/unit/scripts/refresh/*.test.mts', + 'test/unit/scripts/refresh/snapshots/*.test.mts', 'test/unit/scripts/*.test.mts', // Allow loose one-off scripts. 'scripts/*.mts', 'scripts/test/*.mts', + 'scripts/refresh/*.mts', + 'scripts/refresh/snapshots/*.mts', 'test/utils/*.mts', ], defaultProject: 'tsconfig.json', diff --git a/package.json b/package.json index a77f949a8..68bc012db 100644 --- a/package.json +++ b/package.json @@ -48,9 +48,11 @@ "build:package-matrix": "node scripts/build-package-matrix.mts", "test:native": "node scripts/test/native.mts", "test:native:build": "node scripts/test/native.mts --build", - "snapshots": "node scripts/test/snapshots.mts", - "snapshots:update": "node scripts/test/snapshots.mts --update", - "snapshots:update:dep": "node scripts/test/snapshots.mts --update --dep", + "snapshots": "node scripts/refresh/snapshots.mts", + "snapshots:termless:refresh": "node scripts/refresh/snapshots.mts --update", + "snapshots:vite:refresh": "pnpm run test:unit:update", + "snapshots:refresh": "run-s snapshots:termless:refresh snapshots:vite:refresh", + "snapshots:refresh:dep": "node scripts/refresh/snapshots.mts --update --dep", "build:sea:internal:bootstrap": "rollup -c .config/rollup.sea.config.mjs", "check": "node scripts/check.mts", "check:lint": "dotenvx -q run -f .env.local -- eslint --report-unused-disable-directives .", @@ -96,7 +98,7 @@ "test": "pnpm run check --all && run-s test:prepare test:unit integration-tests e2e-tests", "test:prepare": "dotenvx -q run -f .env.test -- pnpm build && del-cli 'test/**/node_modules'", "test:unit": "dotenvx -q run -f .env.test -- vitest run --config .config/vitest.config.mts", - "test:unit:snapshot-dependencies": "pnpm run test:unit test/unit/scripts/test/snapshot-dependencies.test.mts", + "test:unit:snapshot-dependencies": "pnpm run test:unit test/unit/scripts/refresh/snapshots/dependencies.test.mts test/unit/scripts/refresh/snapshots/swap-version.test.mts", "test:unit:update": "dotenvx -q run -f .env.test -- vitest run --config .config/vitest.config.mts --update", "test:unit:coverage": "dotenvx -q run -f .env.test -- vitest run --config .config/vitest.config.mts --coverage", "test-ci": "run-s test:prepare test:unit integration-tests", @@ -149,6 +151,7 @@ "@socketsecurity/config": "3.0.1", "@socketsecurity/registry": "1.1.17", "@socketsecurity/sdk": "4.0.3", + "@termless/vterm": "0.11.0", "@termless/core": "0.11.0", "@termless/xtermjs": "0.11.0", "@types/blessed": "0.1.25", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6253e964d..27eab6942 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -231,6 +231,9 @@ importers: '@termless/core': specifier: 0.11.0 version: 0.11.0(node-pty@1.2.0-beta.18) + '@termless/vterm': + specifier: 0.11.0 + version: 0.11.0(@termless/core@0.11.0(node-pty@1.2.0-beta.18)) '@termless/xtermjs': specifier: 0.11.0 version: 0.11.0(@termless/core@0.11.0(node-pty@1.2.0-beta.18)) @@ -2183,6 +2186,12 @@ packages: node-pty: optional: true + '@termless/vterm@0.11.0': + resolution: {integrity: sha512-+Mwoy7hRc5gloqGxojQbAuyBKcRslflI9D16oU/79jbukFg0RTDLPQXNXTjR39fY8JePSzNAu6qX8YChORp1aw==} + engines: {bun: '>=1.0.0', node: '>=23.6.0'} + peerDependencies: + '@termless/core': ^0.11.0 + '@termless/xtermjs@0.11.0': resolution: {integrity: sha512-0GL6F/65WIE11WKMBcw8nCb2fU+8yLfQJ1QE/0jH4NaFd7UROTbR8pdwzkaAZ2u9YVGXA1GFYAr+jBV/5EF7Uw==} engines: {bun: '>=1.0.0', node: '>=23.6.0'} @@ -5499,6 +5508,10 @@ packages: jsdom: optional: true + vterm.js@0.13.2: + resolution: {integrity: sha512-fhNiN1q1HZa2r4vY3WlVCCAg6VKvQvIa2/8f4qPfKiLZCUMzo1vOHzrk/140LdHK6pfsTm3OoMRtAw1lt9uZeA==} + engines: {node: '>=23.6.0'} + walk-up-path@4.0.0: resolution: {integrity: sha512-3hu+tD8YzSLGuFYtPRb48vdhKMi0KQV5sn+uWr8+7dMEq/2G/dtLrdDinkLjqq5TIbIBjYJ4Ax/n3YiaW7QM8A==} engines: {node: 20 || >=22} @@ -7468,6 +7481,11 @@ snapshots: playwright: 1.65.0 upng-js: 2.1.0 + '@termless/vterm@0.11.0(@termless/core@0.11.0(node-pty@1.2.0-beta.18))': + dependencies: + '@termless/core': 0.11.0(node-pty@1.2.0-beta.18) + vterm.js: 0.13.2 + '@termless/xtermjs@0.11.0(@termless/core@0.11.0(node-pty@1.2.0-beta.18))': dependencies: '@termless/core': 0.11.0(node-pty@1.2.0-beta.18) @@ -11269,6 +11287,8 @@ snapshots: - tsx - yaml + vterm.js@0.13.2: {} + walk-up-path@4.0.0: {} webpack-virtual-modules@0.6.2: {} diff --git a/scripts/test/snapshots.mts b/scripts/refresh/snapshots.mts similarity index 90% rename from scripts/test/snapshots.mts rename to scripts/refresh/snapshots.mts index 0df903ca8..cf3485cf4 100644 --- a/scripts/test/snapshots.mts +++ b/scripts/refresh/snapshots.mts @@ -1,19 +1,17 @@ +import type { SpawnSyncOptions } from 'node:child_process' import { spawnSync } from 'node:child_process' import { promises as fs } from 'node:fs' import path from 'node:path' import process from 'node:process' - +import { isMainModule } from '../lib/is-main-module.mts' +import type { ScriptMeta } from '../lib/run-main.mts' +import { runMain } from '../lib/run-main.mts' +import type { SnapshotDependencyName } from './snapshots/dependencies.mts' import { - SNAPSHOT_DEPENDENCIES, assertSnapshotDependenciesCurrent, normalizeSnapshotDependencyName, -} from './snapshot-dependencies.mts' -import { isMainModule } from '../lib/is-main-module.mts' -import { runMain } from '../lib/run-main.mts' - -import type { SnapshotDependencyName } from './snapshot-dependencies.mts' -import type { ScriptMeta } from '../lib/run-main.mts' -import type { SpawnSyncOptions } from 'node:child_process' + SNAPSHOT_DEPENDENCIES, +} from './snapshots/dependencies.mts' const ROOT = path.resolve(import.meta.dirname, '../..') const ARTIFACTS_ROOT = path.join(ROOT, 'build/native-test-artifacts') @@ -31,8 +29,8 @@ export interface SnapshotOptions { function missingSnapshotDependencyError(): Error { return new Error( - 'Provide a dependency name. Usage: pnpm snapshots:update:dep . ' + - 'Examples: pnpm snapshots:update:dep coana, pnpm snapshots:update:dep socket-patch, or pnpm snapshots:update:dep patch. ' + + 'Provide a dependency name. Usage: pnpm snapshots:refresh:dep . ' + + 'Examples: pnpm snapshots:refresh:dep coana, pnpm snapshots:refresh:dep socket-patch, or pnpm snapshots:refresh:dep patch. ' + 'Socket Python CLI still needs a snapshot mapping. ' + `Currently mapped: ${Object.keys(SNAPSHOT_DEPENDENCIES).join(', ')}, socket-patch.`, ) @@ -94,7 +92,8 @@ export function terminalSnapshotArgs(update: boolean): string[] { 'run', '--config', '.config/vitest.terminal.config.mts', - 'test/unit/utils/self-update.terminal.test.mts', + 'test/e2e/termless.test.mts', + 'test/termless/utils/self-update.test.mts', ...(update ? ['--update'] : []), ] } @@ -170,7 +169,10 @@ export interface SnapshotWorkflowDependencies { createArtifactsDir(): Promise assertDependenciesCurrent(): Promise runNative(update: boolean, artifactsDir: string): void - runDependencyNative(dependencyName: SnapshotDependencyName, artifactsDir: string): void + runDependencyNative( + dependencyName: SnapshotDependencyName, + artifactsDir: string, + ): void runTerminal(update: boolean, artifactsDir: string): void writeTestResult(artifactsDir: string, sourceCommit: string): Promise runReport(artifactsDir: string, reportPath: string): void @@ -209,9 +211,12 @@ const DEFAULT_DEPENDENCIES: SnapshotWorkflowDependencies = { }) }, runDependencyNative(dependencyName, artifactsDir) { - run(['scripts/test/native.mts', ...dependencySnapshotArgs(dependencyName)], { - env: { ...process.env, SOCKET_CLI_NATIVE_TEST_ARTIFACTS: artifactsDir }, - }) + run( + ['scripts/test/native.mts', ...dependencySnapshotArgs(dependencyName)], + { + env: { ...process.env, SOCKET_CLI_NATIVE_TEST_ARTIFACTS: artifactsDir }, + }, + ) }, runTerminal(update, artifactsDir) { run(terminalSnapshotArgs(update), { @@ -273,14 +278,14 @@ export async function main(): Promise { const SCRIPT_META: ScriptMeta = { describe: 'builds, runs, and reports native terminal snapshot tests', help: `Usage: pnpm snapshots [--update|-u] - pnpm snapshots:update - pnpm snapshots:update:dep (coana, socket-patch, patch) + pnpm snapshots:termless:refresh + pnpm snapshots:refresh:dep (coana, socket-patch, patch) Builds the native CLI, runs the focused terminal screenshot tests, and writes a self-contained HTML report into a fresh build/native-test-artifacts folder. Pass --update or -u to update the native screenshot baselines. Use the dep command to rebuild and update only snapshots affected by a pinned tool, for - example: pnpm snapshots:update:dep socket-patch.`, + example: pnpm snapshots:refresh:dep socket-patch.`, } if (isMainModule(import.meta.url)) { diff --git a/scripts/test/snapshot-dependencies.mts b/scripts/refresh/snapshots/dependencies.mts similarity index 83% rename from scripts/test/snapshot-dependencies.mts rename to scripts/refresh/snapshots/dependencies.mts index 16750403a..3091a393b 100644 --- a/scripts/test/snapshot-dependencies.mts +++ b/scripts/refresh/snapshots/dependencies.mts @@ -1,7 +1,7 @@ import { promises as fs } from 'node:fs' import path from 'node:path' -const ROOT = path.resolve(import.meta.dirname, '../..') +const ROOT = path.resolve(import.meta.dirname, '../../..') export interface SnapshotDependency { readonly packageName: string @@ -18,9 +18,9 @@ export const SNAPSHOT_DEPENDENCIES = { source: 'src/constants.mts', versionPattern: /const COANA_CLI_VERSION = ['"]([^'"]+)['"]/, snapshots: [ - 'test/native-snapshots/socket-help-fix.help.svg', - 'test/native-snapshots/socket-help-scan-create.help.svg', - 'test/native-snapshots/socket-help-scan-reach.help.svg', + 'test/snapshots/termless/cli.native.socket-help-fix.svg', + 'test/snapshots/termless/cli.native.socket-help-scan-create.svg', + 'test/snapshots/termless/cli.native.socket-help-scan-reach.svg', ], testNamePattern: 'captures native help for (fix|scan create|scan reach)', }, @@ -29,18 +29,18 @@ export const SNAPSHOT_DEPENDENCIES = { source: 'package.json', versionPattern: /"@socketsecurity\/socket-patch"\s*:\s*"([^"]+)"/, snapshots: [ - 'test/native-snapshots/socket-patch-apply-help.help.svg', - 'test/native-snapshots/socket-patch-rollback-help.help.svg', - 'test/native-snapshots/socket-patch-get-help.help.svg', - 'test/native-snapshots/socket-patch-scan-help.help.svg', - 'test/native-snapshots/socket-patch-list-help.help.svg', - 'test/native-snapshots/socket-patch-remove-help.help.svg', - 'test/native-snapshots/socket-patch-setup-help.help.svg', - 'test/native-snapshots/socket-patch-repair-help.help.svg', - 'test/native-snapshots/socket-patch-version.version.svg', + 'test/snapshots/termless/cli.native.socket-patch-apply-help.svg', + 'test/snapshots/termless/cli.native.socket-patch-rollback-help.svg', + 'test/snapshots/termless/cli.native.socket-patch-get-help.svg', + 'test/snapshots/termless/cli.native.socket-patch-scan-help.svg', + 'test/snapshots/termless/cli.native.socket-patch-list-help.svg', + 'test/snapshots/termless/cli.native.socket-patch-remove-help.svg', + 'test/snapshots/termless/cli.native.socket-patch-setup-help.svg', + 'test/snapshots/termless/cli.native.socket-patch-repair-help.svg', + 'test/snapshots/termless/cli.native.socket-patch-version.svg', ], versionSnapshots: [ - 'test/native-snapshots/socket-patch-version.version.svg', + 'test/snapshots/termless/cli.native.socket-patch-version.svg', ], testNamePattern: 'captures bundled patch help for (apply|rollback|get|scan|list|remove|setup|repair)|captures bundled socket-patch version', @@ -184,7 +184,7 @@ export function snapshotDependencyUpdateHint( dependency => `Snapshot output for ${dependency.packageName}@${dependency.version} is stale:\n` + dependency.snapshots.map(snapshot => ` - ${snapshot}`).join('\n') + - `\nRun: pnpm snapshots:update:dep ${dependency.dependencyName}`, + `\nRun: pnpm snapshots:refresh:dep ${dependency.dependencyName}`, ) .join('\n\n') } diff --git a/scripts/test/swap-snapshot-version.mts b/scripts/refresh/snapshots/swap-version.mts similarity index 82% rename from scripts/test/swap-snapshot-version.mts rename to scripts/refresh/snapshots/swap-version.mts index fbc93a1d1..86a0a2e34 100644 --- a/scripts/test/swap-snapshot-version.mts +++ b/scripts/refresh/snapshots/swap-version.mts @@ -5,29 +5,28 @@ * but cannot build the native CLI. * * Usage: - * node scripts/test/swap-snapshot-version.mts --dep coana --from 15.15.0 + * node scripts/refresh/snapshots/swap-version.mts --dep coana --from 15.15.0 */ import { promises as fs } from 'node:fs' import path from 'node:path' import process from 'node:process' import { parseArgs } from 'node:util' +import { isMainModule } from '../../lib/is-main-module.mts' +import type { ScriptMeta } from '../../lib/run-main.mts' +import { runMain } from '../../lib/run-main.mts' +import type { SnapshotDependency } from './dependencies.mts' import { - SNAPSHOT_DEPENDENCIES, findStaleSnapshotDependencies, normalizeSnapshotDependencyName, readPinnedVersion, + SNAPSHOT_DEPENDENCIES as snapshotDependencies, snapshotDependencyUpdateHint, swapVersionInSnapshot, -} from './snapshot-dependencies.mts' -import { isMainModule } from '../lib/is-main-module.mts' -import { runMain } from '../lib/run-main.mts' +} from './dependencies.mts' -import type { SnapshotDependency } from './snapshot-dependencies.mts' -import type { ScriptMeta } from '../lib/run-main.mts' - -const ROOT = path.resolve(import.meta.dirname, '../..') +const ROOT = path.resolve(import.meta.dirname, '../../..') export interface SwapArgs { readonly dependencyName: string @@ -52,7 +51,7 @@ export async function main(): Promise { if (!name) { throw new Error(`Unknown snapshot dependency: ${dependencyName}`) } - const dependency: SnapshotDependency = SNAPSHOT_DEPENDENCIES[name] + const dependency: SnapshotDependency = snapshotDependencies[name] const to = await readPinnedVersion(dependency) const snapshots = dependency.versionSnapshots ?? dependency.snapshots // Swap every file in memory first, so a failure leaves none of them edited. @@ -91,7 +90,7 @@ export async function main(): Promise { const SCRIPT_META: ScriptMeta = { describe: "moves a pinned tool's native snapshots to its pinned version without a native build", - help: `Usage: node scripts/test/swap-snapshot-version.mts --dep --from + help: `Usage: node scripts/refresh/snapshots/swap-version.mts --dep --from --dep coana, socket-patch or patch --from the version the snapshots show now diff --git a/scripts/test/native.mts b/scripts/test/native.mts index 2cb1184b4..393dbb95c 100644 --- a/scripts/test/native.mts +++ b/scripts/test/native.mts @@ -1,20 +1,18 @@ +import type { SpawnSyncOptions } from 'node:child_process' import { spawnSync } from 'node:child_process' import { createHash } from 'node:crypto' import { promises as fs } from 'node:fs' import os from 'node:os' import path from 'node:path' import process from 'node:process' - +import { isMainModule } from '../lib/is-main-module.mts' +import type { ScriptMeta } from '../lib/run-main.mts' +import { runMain } from '../lib/run-main.mts' +import { assertSnapshotDependenciesCurrent } from '../refresh/snapshots/dependencies.mts' import { persistNativeSigningReceipt, prepareNativeTestBinary, } from './apple-signing.mts' -import { assertSnapshotDependenciesCurrent } from './snapshot-dependencies.mts' -import { isMainModule } from '../lib/is-main-module.mts' -import { runMain } from '../lib/run-main.mts' - -import type { ScriptMeta } from '../lib/run-main.mts' -import type { SpawnSyncOptions } from 'node:child_process' type NativeManifest = { application: { name: string; version: string } @@ -241,9 +239,8 @@ async function main(): Promise { ) } process.env['SOCKET_CLI_NATIVE_TEST_NODE_VERSION'] = nodeRuntime.version - process.env['SOCKET_CLI_NATIVE_TEST_UPDATE_SNAPSHOTS'] = String( - updatesSnapshots, - ) + process.env['SOCKET_CLI_NATIVE_TEST_UPDATE_SNAPSHOTS'] = + String(updatesSnapshots) // Give this run private package-manager caches so npm npx and pnpm dlx // never contend with each other or other local/test-runner activity. process.env['HOME'] = path.join(stageDir, 'home') diff --git a/src/sea/README.md b/src/sea/README.md index ba87b7661..9d289293a 100644 --- a/src/sea/README.md +++ b/src/sea/README.md @@ -59,7 +59,7 @@ Use the executable's `--version` output and the adjacent manifest's recorded Soc Use Node 26.13.0 and build the prototype on the host OS before running its native tests: -For the screenshot baseline workflow, run `pnpm snapshots` to rebuild and verify the focused screenshot suites, or `pnpm snapshots:update` (equivalent to `pnpm snapshots -u`) to update baselines. Both commands print the self-contained report path. +Run `pnpm snapshots` to verify the terminal screenshots and print the HTML report path. Use `pnpm snapshots:termless:refresh` to refresh the images, `pnpm snapshots:vite:refresh` for Vitest unit snapshots, or `pnpm snapshots:refresh` for both. ```sh pnpm build:sea -- --prototype diff --git a/test/e2e/termless.test.mts b/test/e2e/termless.test.mts new file mode 100644 index 000000000..0c4b57b65 --- /dev/null +++ b/test/e2e/termless.test.mts @@ -0,0 +1,42 @@ +import { join } from 'node:path' + +import { createTerminal } from '@termless/core' +import { createVtermBackend } from '@termless/vterm' +import { onTestFinished, test } from 'vitest' + +import { + captureCheckpoint, + createRecording, + expectTerminalAnimation, +} from '../lib/termless/animation.mts' + +test('captures the node -e fixture before and after Enter', async () => { + const terminal = createTerminal({ + backend: createVtermBackend(), + cols: 48, + rows: 8, + }) + onTestFinished(() => terminal.close()) + const script = [ + "process.stdout.write('PTY fixture\\r\\n> ready')", + "process.stdin.once('data', () => { process.stdout.write('\\x1b[2J\\x1b[HEnter received\\r\\n'); process.exit(0) })", + ].join(';') + + await terminal.spawn([process.execPath, '-e', script]) + await terminal.waitFor('> ready', 5000) + const prompt = await captureCheckpoint(terminal, 'prompt') + + terminal.press('Enter') + await terminal.waitFor('Enter received', 5000) + const complete = await captureCheckpoint(terminal, 'after-enter') + + await expectTerminalAnimation(createRecording([prompt, complete]), { + flow: 'node-e-fixture', + expectedSequence: ['prompt', 'after-enter'], + snapshotsDir: join(process.cwd(), 'test/snapshots/termless'), + durations: [400, 400], + artifactsDir: + process.env['SOCKET_CLI_NATIVE_TEST_ARTIFACTS'] ?? + join(process.cwd(), 'build/native-test-artifacts'), + }) +}) diff --git a/test/lib/native/cli-harness.mts b/test/lib/native/cli-harness.mts index 8966d030c..62fa21e86 100644 --- a/test/lib/native/cli-harness.mts +++ b/test/lib/native/cli-harness.mts @@ -9,7 +9,7 @@ import { captureCheckpoint, createRecording, expectTerminalAnimation, -} from '../terminal/animation.mts' +} from '../termless/animation.mts' import { normalizeBackendOutput } from '../terminal/output.mts' export interface NativeTestEnvironment { @@ -145,7 +145,7 @@ export async function captureFlow(options: { ) await expectTerminalAnimation(createRecording([checkpoint]), { flow, - snapshotsDir: path.join(process.cwd(), 'test/native-snapshots'), + snapshotsDir: path.join(process.cwd(), 'test/snapshots/termless'), artifactsDir: process.env['SOCKET_CLI_NATIVE_TEST_ARTIFACTS'] ?? path.join(process.cwd(), 'build/native-test-artifacts'), diff --git a/test/lib/terminal/animation.mts b/test/lib/termless/animation.mts similarity index 96% rename from test/lib/terminal/animation.mts rename to test/lib/termless/animation.mts index 58af1a97c..1d46c256a 100644 --- a/test/lib/terminal/animation.mts +++ b/test/lib/termless/animation.mts @@ -9,7 +9,7 @@ import { } from '@termless/core' import { expect } from 'vitest' -import { optimizeSvg } from '../optimize-svg.mts' +import { optimizeSvg } from './svgo.mts' import type { AnimationFrame, @@ -189,7 +189,7 @@ export function renderCaptured( // Pinned Termless 0.11.0 separates keyframe blocks with invalid semicolons, // which browsers use to discard later frames; repair only that generated CSS. -export function createTerminalAnimationSvg( +export function createTermlessAnimationSvg( frames: AnimationFrame[], options?: AnimationOptions, ): string { @@ -331,7 +331,7 @@ export async function expectTerminalAnimation( if (animationFrames.length > 1) { await writeFile( path.join(flowDir, 'animation.svg'), - createTerminalAnimationSvg(animationFrames), + createTermlessAnimationSvg(animationFrames), ) } await writeFile( @@ -351,6 +351,11 @@ export async function expectTerminalAnimation( } const isSnapshotUpdate = process.env['SOCKET_CLI_NATIVE_TEST_UPDATE_SNAPSHOTS'] === 'true' + const testPath = expect.getState().testPath + if (!testPath) { + throw new Error('Terminal snapshots require an active Vitest test file') + } + const owner = path.basename(testPath, '.test.mts') const baselineRasterizer = !isSnapshotUpdate ? await selectRasterizer('resvg') : undefined @@ -359,7 +364,7 @@ export async function expectTerminalAnimation( checkpoints.map(async checkpoint => { const svgPath = path.join( options.snapshotsDir, - `${options.flow}.${checkpoint.name}.svg`, + `${owner}.${options.flow}${checkpoints.length > 1 ? `.${checkpoint.name}` : ''}.svg`, ) if (baselineRasterizer) { const expectedSvg = await readFile(svgPath, 'utf8') diff --git a/test/lib/optimize-svg.mts b/test/lib/termless/svgo.mts similarity index 100% rename from test/lib/optimize-svg.mts rename to test/lib/termless/svgo.mts diff --git a/test/native/commands/cli-behavior.native.test.mts b/test/native/commands/cli-behavior.native.test.mts index 807f37248..ab235282f 100644 --- a/test/native/commands/cli-behavior.native.test.mts +++ b/test/native/commands/cli-behavior.native.test.mts @@ -11,14 +11,14 @@ import { captureCheckpoint, createRecording, expectTerminalAnimation, -} from '../../lib/terminal/animation.mts' +} from '../../lib/termless/animation.mts' const binary = process.env['SOCKET_CLI_NATIVE_TEST_BINARY'] describe('native CLI behavior', () => { it('reads an explicit config value', async () => { await captureFlow({ - flow: 'behavior-config-get', + flow: 'config-get', checkpointName: 'output', args: ['config', 'get', 'defaultOrg'], expectedText: 'native-fixture', @@ -29,7 +29,7 @@ describe('native CLI behavior', () => { it('lists an explicit config without persisting it', async () => { await captureFlow({ - flow: 'behavior-config-list', + flow: 'config-list', checkpointName: 'output', args: ['config', 'list'], expectedText: 'native-fixture', @@ -41,7 +41,7 @@ describe('native CLI behavior', () => { it('rejects an unknown config key', async () => { await captureFlow({ - flow: 'behavior-config-invalid-key', + flow: 'config-invalid-key', checkpointName: 'output', args: ['config', 'get', 'invalid-native-key'], expectedText: 'invalid config key', @@ -51,7 +51,7 @@ describe('native CLI behavior', () => { it('shows a missing socket.json error in an isolated directory', async () => { await captureFlow({ - flow: 'behavior-json-missing', + flow: 'json-missing', checkpointName: 'output', args: ['json'], expectedText: 'Not found:', @@ -61,7 +61,7 @@ describe('native CLI behavior', () => { it('prints a seeded socket.json fixture', async () => { await captureFlow({ - flow: 'behavior-json-seeded', + flow: 'json-seeded', checkpointName: 'output', args: ['json'], expectedText: '"projectIgnorePaths"', @@ -77,7 +77,7 @@ describe('native CLI behavior', () => { it('validates wrapper mode before applying the dry-run guard', async () => { await captureFlow({ - flow: 'behavior-wrapper-on-dry-run', + flow: 'wrapper-on-dry-run', checkpointName: 'output', args: ['wrapper', 'on', '--dry-run'], expectedText: '[DryRun]', @@ -108,8 +108,8 @@ describe('native CLI behavior', () => { fixture.normalizer.flush() const canceled = await captureCheckpoint(fixture.terminal, 'canceled') await expectTerminalAnimation(createRecording([menu, selected, canceled]), { - flow: 'behavior-manifest-setup', - snapshotsDir: path.join(process.cwd(), 'test/native-snapshots'), + flow: 'manifest-setup', + snapshotsDir: path.join(process.cwd(), 'test/snapshots/termless'), artifactsDir: process.env['SOCKET_CLI_NATIVE_TEST_ARTIFACTS'] ?? path.join(process.cwd(), 'build/native-test-artifacts'), diff --git a/test/native/commands/cli.native.test.mts b/test/native/commands/cli.native.test.mts index dfd8bce2c..8150d72ff 100644 --- a/test/native/commands/cli.native.test.mts +++ b/test/native/commands/cli.native.test.mts @@ -18,14 +18,14 @@ import { captureCheckpoint, createRecording, expectTerminalAnimation, -} from '../../lib/terminal/animation.mts' +} from '../../lib/termless/animation.mts' const binary = process.env['SOCKET_CLI_NATIVE_TEST_BINARY'] if (!binary) { throw new Error('Use pnpm test:native to run native CLI tests') } -const snapshotDir = path.join(process.cwd(), 'test/native-snapshots') +const snapshotDir = path.join(process.cwd(), 'test/snapshots/termless') const artifactDir = process.env['SOCKET_CLI_NATIVE_TEST_ARTIFACTS'] ?? path.join(process.cwd(), 'build/native-test-artifacts') diff --git a/test/native/commands/tui.native.test.mts b/test/native/commands/tui.native.test.mts index 8b87b1a9b..7d1d50e6c 100644 --- a/test/native/commands/tui.native.test.mts +++ b/test/native/commands/tui.native.test.mts @@ -8,14 +8,14 @@ import { captureCheckpoint, createRecording, expectTerminalAnimation, -} from '../../lib/terminal/animation.mts' +} from '../../lib/termless/animation.mts' const binary = process.env['SOCKET_CLI_NATIVE_TEST_BINARY'] if (!binary) { throw new Error('Use pnpm test:native to run native CLI tests') } -const snapshotDir = path.join(process.cwd(), 'test/native-snapshots') +const snapshotDir = path.join(process.cwd(), 'test/snapshots/termless') const artifactDir = process.env['SOCKET_CLI_NATIVE_TEST_ARTIFACTS'] ?? path.join(process.cwd(), 'build/native-test-artifacts') @@ -57,7 +57,7 @@ describe('native blessed terminal interfaces', () => { .toBe('exit=0') normalizer.flush() await expectTerminalAnimation(createRecording([checkpoint]), { - flow: 'native-analytics-tui', + flow: 'analytics', snapshotsDir: snapshotDir, artifactsDir: artifactDir, expectedSequence: ['charts'], @@ -81,7 +81,7 @@ describe('native blessed terminal interfaces', () => { .toBe('exit=0') normalizer.flush() await expectTerminalAnimation(createRecording([checkpoint]), { - flow: 'native-audit-log-tui', + flow: 'audit-log', snapshotsDir: snapshotDir, artifactsDir: artifactDir, expectedSequence: ['table'], @@ -105,7 +105,7 @@ describe('native blessed terminal interfaces', () => { .toBe('exit=0') normalizer.flush() await expectTerminalAnimation(createRecording([checkpoint]), { - flow: 'native-threat-feed-tui', + flow: 'threat-feed', snapshotsDir: snapshotDir, artifactsDir: artifactDir, expectedSequence: ['table'], diff --git a/test/snapshots/.gitattributes b/test/snapshots/.gitattributes new file mode 100644 index 000000000..d663dead6 --- /dev/null +++ b/test/snapshots/.gitattributes @@ -0,0 +1,2 @@ +*.svg binary linguist-generated=true +*.png binary linguist-generated=true diff --git a/test/native-snapshots/behavior-config-get.output.svg b/test/snapshots/termless/cli-behavior.native.config-get.svg similarity index 100% rename from test/native-snapshots/behavior-config-get.output.svg rename to test/snapshots/termless/cli-behavior.native.config-get.svg diff --git a/test/native-snapshots/behavior-config-invalid-key.output.svg b/test/snapshots/termless/cli-behavior.native.config-invalid-key.svg similarity index 100% rename from test/native-snapshots/behavior-config-invalid-key.output.svg rename to test/snapshots/termless/cli-behavior.native.config-invalid-key.svg diff --git a/test/native-snapshots/behavior-config-list.output.svg b/test/snapshots/termless/cli-behavior.native.config-list.svg similarity index 100% rename from test/native-snapshots/behavior-config-list.output.svg rename to test/snapshots/termless/cli-behavior.native.config-list.svg diff --git a/test/native-snapshots/behavior-json-missing.output.svg b/test/snapshots/termless/cli-behavior.native.json-missing.svg similarity index 100% rename from test/native-snapshots/behavior-json-missing.output.svg rename to test/snapshots/termless/cli-behavior.native.json-missing.svg diff --git a/test/native-snapshots/behavior-json-seeded.output.svg b/test/snapshots/termless/cli-behavior.native.json-seeded.svg similarity index 100% rename from test/native-snapshots/behavior-json-seeded.output.svg rename to test/snapshots/termless/cli-behavior.native.json-seeded.svg diff --git a/test/native-snapshots/behavior-manifest-setup.canceled.svg b/test/snapshots/termless/cli-behavior.native.manifest-setup.canceled.svg similarity index 100% rename from test/native-snapshots/behavior-manifest-setup.canceled.svg rename to test/snapshots/termless/cli-behavior.native.manifest-setup.canceled.svg diff --git a/test/native-snapshots/behavior-manifest-setup.exit-selected.svg b/test/snapshots/termless/cli-behavior.native.manifest-setup.exit-selected.svg similarity index 100% rename from test/native-snapshots/behavior-manifest-setup.exit-selected.svg rename to test/snapshots/termless/cli-behavior.native.manifest-setup.exit-selected.svg diff --git a/test/native-snapshots/behavior-manifest-setup.menu.svg b/test/snapshots/termless/cli-behavior.native.manifest-setup.menu.svg similarity index 100% rename from test/native-snapshots/behavior-manifest-setup.menu.svg rename to test/snapshots/termless/cli-behavior.native.manifest-setup.menu.svg diff --git a/test/native-snapshots/behavior-wrapper-on-dry-run.output.svg b/test/snapshots/termless/cli-behavior.native.wrapper-on-dry-run.svg similarity index 100% rename from test/native-snapshots/behavior-wrapper-on-dry-run.output.svg rename to test/snapshots/termless/cli-behavior.native.wrapper-on-dry-run.svg diff --git a/test/native-snapshots/socket-cdxgen-unsupported-type.unsupported-type.svg b/test/snapshots/termless/cli.native.socket-cdxgen-unsupported-type.svg similarity index 100% rename from test/native-snapshots/socket-cdxgen-unsupported-type.unsupported-type.svg rename to test/snapshots/termless/cli.native.socket-cdxgen-unsupported-type.svg diff --git a/test/native-snapshots/socket-help-analytics.help.svg b/test/snapshots/termless/cli.native.socket-help-analytics.svg similarity index 100% rename from test/native-snapshots/socket-help-analytics.help.svg rename to test/snapshots/termless/cli.native.socket-help-analytics.svg diff --git a/test/native-snapshots/socket-help-audit-log.help.svg b/test/snapshots/termless/cli.native.socket-help-audit-log.svg similarity index 100% rename from test/native-snapshots/socket-help-audit-log.help.svg rename to test/snapshots/termless/cli.native.socket-help-audit-log.svg diff --git a/test/native-snapshots/socket-help-cdxgen.help.svg b/test/snapshots/termless/cli.native.socket-help-cdxgen.svg similarity index 100% rename from test/native-snapshots/socket-help-cdxgen.help.svg rename to test/snapshots/termless/cli.native.socket-help-cdxgen.svg diff --git a/test/native-snapshots/socket-help-ci.help.svg b/test/snapshots/termless/cli.native.socket-help-ci.svg similarity index 100% rename from test/native-snapshots/socket-help-ci.help.svg rename to test/snapshots/termless/cli.native.socket-help-ci.svg diff --git a/test/native-snapshots/socket-help-config-auto.help.svg b/test/snapshots/termless/cli.native.socket-help-config-auto.svg similarity index 100% rename from test/native-snapshots/socket-help-config-auto.help.svg rename to test/snapshots/termless/cli.native.socket-help-config-auto.svg diff --git a/test/native-snapshots/socket-help-config-get.help.svg b/test/snapshots/termless/cli.native.socket-help-config-get.svg similarity index 100% rename from test/native-snapshots/socket-help-config-get.help.svg rename to test/snapshots/termless/cli.native.socket-help-config-get.svg diff --git a/test/native-snapshots/socket-help-config-list.help.svg b/test/snapshots/termless/cli.native.socket-help-config-list.svg similarity index 100% rename from test/native-snapshots/socket-help-config-list.help.svg rename to test/snapshots/termless/cli.native.socket-help-config-list.svg diff --git a/test/native-snapshots/socket-help-config-set.help.svg b/test/snapshots/termless/cli.native.socket-help-config-set.svg similarity index 100% rename from test/native-snapshots/socket-help-config-set.help.svg rename to test/snapshots/termless/cli.native.socket-help-config-set.svg diff --git a/test/native-snapshots/socket-help-config-unset.help.svg b/test/snapshots/termless/cli.native.socket-help-config-unset.svg similarity index 100% rename from test/native-snapshots/socket-help-config-unset.help.svg rename to test/snapshots/termless/cli.native.socket-help-config-unset.svg diff --git a/test/native-snapshots/socket-help-config.help.svg b/test/snapshots/termless/cli.native.socket-help-config.svg similarity index 100% rename from test/native-snapshots/socket-help-config.help.svg rename to test/snapshots/termless/cli.native.socket-help-config.svg diff --git a/test/native-snapshots/socket-help-dependencies.help.svg b/test/snapshots/termless/cli.native.socket-help-dependencies.svg similarity index 100% rename from test/native-snapshots/socket-help-dependencies.help.svg rename to test/snapshots/termless/cli.native.socket-help-dependencies.svg diff --git a/test/native-snapshots/socket-help-fix.help.svg b/test/snapshots/termless/cli.native.socket-help-fix.svg similarity index 100% rename from test/native-snapshots/socket-help-fix.help.svg rename to test/snapshots/termless/cli.native.socket-help-fix.svg diff --git a/test/native-snapshots/socket-help-install-completion.help.svg b/test/snapshots/termless/cli.native.socket-help-install-completion.svg similarity index 100% rename from test/native-snapshots/socket-help-install-completion.help.svg rename to test/snapshots/termless/cli.native.socket-help-install-completion.svg diff --git a/test/native-snapshots/socket-help-install.help.svg b/test/snapshots/termless/cli.native.socket-help-install.svg similarity index 100% rename from test/native-snapshots/socket-help-install.help.svg rename to test/snapshots/termless/cli.native.socket-help-install.svg diff --git a/test/native-snapshots/socket-help-json.help.svg b/test/snapshots/termless/cli.native.socket-help-json.svg similarity index 100% rename from test/native-snapshots/socket-help-json.help.svg rename to test/snapshots/termless/cli.native.socket-help-json.svg diff --git a/test/native-snapshots/socket-help-license.help.svg b/test/snapshots/termless/cli.native.socket-help-license.svg similarity index 100% rename from test/native-snapshots/socket-help-license.help.svg rename to test/snapshots/termless/cli.native.socket-help-license.svg diff --git a/test/native-snapshots/socket-help-login.help.svg b/test/snapshots/termless/cli.native.socket-help-login.svg similarity index 100% rename from test/native-snapshots/socket-help-login.help.svg rename to test/snapshots/termless/cli.native.socket-help-login.svg diff --git a/test/native-snapshots/socket-help-logout.help.svg b/test/snapshots/termless/cli.native.socket-help-logout.svg similarity index 100% rename from test/native-snapshots/socket-help-logout.help.svg rename to test/snapshots/termless/cli.native.socket-help-logout.svg diff --git a/test/native-snapshots/socket-help-manifest-auto.help.svg b/test/snapshots/termless/cli.native.socket-help-manifest-auto.svg similarity index 100% rename from test/native-snapshots/socket-help-manifest-auto.help.svg rename to test/snapshots/termless/cli.native.socket-help-manifest-auto.svg diff --git a/test/native-snapshots/socket-help-manifest-bazel.help.svg b/test/snapshots/termless/cli.native.socket-help-manifest-bazel.svg similarity index 100% rename from test/native-snapshots/socket-help-manifest-bazel.help.svg rename to test/snapshots/termless/cli.native.socket-help-manifest-bazel.svg diff --git a/test/native-snapshots/socket-help-manifest-cdxgen.help.svg b/test/snapshots/termless/cli.native.socket-help-manifest-cdxgen.svg similarity index 100% rename from test/native-snapshots/socket-help-manifest-cdxgen.help.svg rename to test/snapshots/termless/cli.native.socket-help-manifest-cdxgen.svg diff --git a/test/native-snapshots/socket-help-manifest-conda.help.svg b/test/snapshots/termless/cli.native.socket-help-manifest-conda.svg similarity index 100% rename from test/native-snapshots/socket-help-manifest-conda.help.svg rename to test/snapshots/termless/cli.native.socket-help-manifest-conda.svg diff --git a/test/native-snapshots/socket-help-manifest-dotnet.help.svg b/test/snapshots/termless/cli.native.socket-help-manifest-dotnet.svg similarity index 100% rename from test/native-snapshots/socket-help-manifest-dotnet.help.svg rename to test/snapshots/termless/cli.native.socket-help-manifest-dotnet.svg diff --git a/test/native-snapshots/socket-help-manifest-dynamic-sbom-inference.help.svg b/test/snapshots/termless/cli.native.socket-help-manifest-dynamic-sbom-inference.svg similarity index 100% rename from test/native-snapshots/socket-help-manifest-dynamic-sbom-inference.help.svg rename to test/snapshots/termless/cli.native.socket-help-manifest-dynamic-sbom-inference.svg diff --git a/test/native-snapshots/socket-help-manifest-gradle.help.svg b/test/snapshots/termless/cli.native.socket-help-manifest-gradle.svg similarity index 100% rename from test/native-snapshots/socket-help-manifest-gradle.help.svg rename to test/snapshots/termless/cli.native.socket-help-manifest-gradle.svg diff --git a/test/native-snapshots/socket-help-manifest-kotlin.help.svg b/test/snapshots/termless/cli.native.socket-help-manifest-kotlin.svg similarity index 100% rename from test/native-snapshots/socket-help-manifest-kotlin.help.svg rename to test/snapshots/termless/cli.native.socket-help-manifest-kotlin.svg diff --git a/test/native-snapshots/socket-help-manifest-maven.help.svg b/test/snapshots/termless/cli.native.socket-help-manifest-maven.svg similarity index 100% rename from test/native-snapshots/socket-help-manifest-maven.help.svg rename to test/snapshots/termless/cli.native.socket-help-manifest-maven.svg diff --git a/test/native-snapshots/socket-help-manifest-scala.help.svg b/test/snapshots/termless/cli.native.socket-help-manifest-scala.svg similarity index 100% rename from test/native-snapshots/socket-help-manifest-scala.help.svg rename to test/snapshots/termless/cli.native.socket-help-manifest-scala.svg diff --git a/test/native-snapshots/socket-help-manifest-setup.help.svg b/test/snapshots/termless/cli.native.socket-help-manifest-setup.svg similarity index 100% rename from test/native-snapshots/socket-help-manifest-setup.help.svg rename to test/snapshots/termless/cli.native.socket-help-manifest-setup.svg diff --git a/test/native-snapshots/socket-help-manifest.help.svg b/test/snapshots/termless/cli.native.socket-help-manifest.svg similarity index 100% rename from test/native-snapshots/socket-help-manifest.help.svg rename to test/snapshots/termless/cli.native.socket-help-manifest.svg diff --git a/test/native-snapshots/socket-help-npm.help.svg b/test/snapshots/termless/cli.native.socket-help-npm.svg similarity index 100% rename from test/native-snapshots/socket-help-npm.help.svg rename to test/snapshots/termless/cli.native.socket-help-npm.svg diff --git a/test/native-snapshots/socket-help-npx.help.svg b/test/snapshots/termless/cli.native.socket-help-npx.svg similarity index 100% rename from test/native-snapshots/socket-help-npx.help.svg rename to test/snapshots/termless/cli.native.socket-help-npx.svg diff --git a/test/native-snapshots/socket-help-oops.help.svg b/test/snapshots/termless/cli.native.socket-help-oops.svg similarity index 100% rename from test/native-snapshots/socket-help-oops.help.svg rename to test/snapshots/termless/cli.native.socket-help-oops.svg diff --git a/test/native-snapshots/socket-help-optimize.help.svg b/test/snapshots/termless/cli.native.socket-help-optimize.svg similarity index 100% rename from test/native-snapshots/socket-help-optimize.help.svg rename to test/snapshots/termless/cli.native.socket-help-optimize.svg diff --git a/test/native-snapshots/socket-help-organization-dependencies.help.svg b/test/snapshots/termless/cli.native.socket-help-organization-dependencies.svg similarity index 100% rename from test/native-snapshots/socket-help-organization-dependencies.help.svg rename to test/snapshots/termless/cli.native.socket-help-organization-dependencies.svg diff --git a/test/native-snapshots/socket-help-organization-list.help.svg b/test/snapshots/termless/cli.native.socket-help-organization-list.svg similarity index 100% rename from test/native-snapshots/socket-help-organization-list.help.svg rename to test/snapshots/termless/cli.native.socket-help-organization-list.svg diff --git a/test/native-snapshots/socket-help-organization-policy-license.help.svg b/test/snapshots/termless/cli.native.socket-help-organization-policy-license.svg similarity index 100% rename from test/native-snapshots/socket-help-organization-policy-license.help.svg rename to test/snapshots/termless/cli.native.socket-help-organization-policy-license.svg diff --git a/test/native-snapshots/socket-help-organization-policy-security.help.svg b/test/snapshots/termless/cli.native.socket-help-organization-policy-security.svg similarity index 100% rename from test/native-snapshots/socket-help-organization-policy-security.help.svg rename to test/snapshots/termless/cli.native.socket-help-organization-policy-security.svg diff --git a/test/native-snapshots/socket-help-organization-policy.help.svg b/test/snapshots/termless/cli.native.socket-help-organization-policy.svg similarity index 100% rename from test/native-snapshots/socket-help-organization-policy.help.svg rename to test/snapshots/termless/cli.native.socket-help-organization-policy.svg diff --git a/test/native-snapshots/socket-help-organization-quota.help.svg b/test/snapshots/termless/cli.native.socket-help-organization-quota.svg similarity index 100% rename from test/native-snapshots/socket-help-organization-quota.help.svg rename to test/snapshots/termless/cli.native.socket-help-organization-quota.svg diff --git a/test/native-snapshots/socket-help-organization.help.svg b/test/snapshots/termless/cli.native.socket-help-organization.svg similarity index 100% rename from test/native-snapshots/socket-help-organization.help.svg rename to test/snapshots/termless/cli.native.socket-help-organization.svg diff --git a/test/native-snapshots/socket-help-package-score.help.svg b/test/snapshots/termless/cli.native.socket-help-package-score.svg similarity index 100% rename from test/native-snapshots/socket-help-package-score.help.svg rename to test/snapshots/termless/cli.native.socket-help-package-score.svg diff --git a/test/native-snapshots/socket-help-package-shallow.help.svg b/test/snapshots/termless/cli.native.socket-help-package-shallow.svg similarity index 100% rename from test/native-snapshots/socket-help-package-shallow.help.svg rename to test/snapshots/termless/cli.native.socket-help-package-shallow.svg diff --git a/test/native-snapshots/socket-help-package.help.svg b/test/snapshots/termless/cli.native.socket-help-package.svg similarity index 100% rename from test/native-snapshots/socket-help-package.help.svg rename to test/snapshots/termless/cli.native.socket-help-package.svg diff --git a/test/native-snapshots/socket-help-patch.help.svg b/test/snapshots/termless/cli.native.socket-help-patch.svg similarity index 100% rename from test/native-snapshots/socket-help-patch.help.svg rename to test/snapshots/termless/cli.native.socket-help-patch.svg diff --git a/test/native-snapshots/socket-help-pnpm.help.svg b/test/snapshots/termless/cli.native.socket-help-pnpm.svg similarity index 100% rename from test/native-snapshots/socket-help-pnpm.help.svg rename to test/snapshots/termless/cli.native.socket-help-pnpm.svg diff --git a/test/native-snapshots/socket-help-raw-npm.help.svg b/test/snapshots/termless/cli.native.socket-help-raw-npm.svg similarity index 100% rename from test/native-snapshots/socket-help-raw-npm.help.svg rename to test/snapshots/termless/cli.native.socket-help-raw-npm.svg diff --git a/test/native-snapshots/socket-help-raw-npx.help.svg b/test/snapshots/termless/cli.native.socket-help-raw-npx.svg similarity index 100% rename from test/native-snapshots/socket-help-raw-npx.help.svg rename to test/snapshots/termless/cli.native.socket-help-raw-npx.svg diff --git a/test/native-snapshots/socket-help-repository-create.help.svg b/test/snapshots/termless/cli.native.socket-help-repository-create.svg similarity index 100% rename from test/native-snapshots/socket-help-repository-create.help.svg rename to test/snapshots/termless/cli.native.socket-help-repository-create.svg diff --git a/test/native-snapshots/socket-help-repository-del.help.svg b/test/snapshots/termless/cli.native.socket-help-repository-del.svg similarity index 100% rename from test/native-snapshots/socket-help-repository-del.help.svg rename to test/snapshots/termless/cli.native.socket-help-repository-del.svg diff --git a/test/native-snapshots/socket-help-repository-list.help.svg b/test/snapshots/termless/cli.native.socket-help-repository-list.svg similarity index 100% rename from test/native-snapshots/socket-help-repository-list.help.svg rename to test/snapshots/termless/cli.native.socket-help-repository-list.svg diff --git a/test/native-snapshots/socket-help-repository-update.help.svg b/test/snapshots/termless/cli.native.socket-help-repository-update.svg similarity index 100% rename from test/native-snapshots/socket-help-repository-update.help.svg rename to test/snapshots/termless/cli.native.socket-help-repository-update.svg diff --git a/test/native-snapshots/socket-help-repository-view.help.svg b/test/snapshots/termless/cli.native.socket-help-repository-view.svg similarity index 100% rename from test/native-snapshots/socket-help-repository-view.help.svg rename to test/snapshots/termless/cli.native.socket-help-repository-view.svg diff --git a/test/native-snapshots/socket-help-repository.help.svg b/test/snapshots/termless/cli.native.socket-help-repository.svg similarity index 100% rename from test/native-snapshots/socket-help-repository.help.svg rename to test/snapshots/termless/cli.native.socket-help-repository.svg diff --git a/test/native-snapshots/socket-help-scan-create.help.svg b/test/snapshots/termless/cli.native.socket-help-scan-create.svg similarity index 100% rename from test/native-snapshots/socket-help-scan-create.help.svg rename to test/snapshots/termless/cli.native.socket-help-scan-create.svg diff --git a/test/native-snapshots/socket-help-scan-del.help.svg b/test/snapshots/termless/cli.native.socket-help-scan-del.svg similarity index 100% rename from test/native-snapshots/socket-help-scan-del.help.svg rename to test/snapshots/termless/cli.native.socket-help-scan-del.svg diff --git a/test/native-snapshots/socket-help-scan-diff.help.svg b/test/snapshots/termless/cli.native.socket-help-scan-diff.svg similarity index 100% rename from test/native-snapshots/socket-help-scan-diff.help.svg rename to test/snapshots/termless/cli.native.socket-help-scan-diff.svg diff --git a/test/native-snapshots/socket-help-scan-github.help.svg b/test/snapshots/termless/cli.native.socket-help-scan-github.svg similarity index 100% rename from test/native-snapshots/socket-help-scan-github.help.svg rename to test/snapshots/termless/cli.native.socket-help-scan-github.svg diff --git a/test/native-snapshots/socket-help-scan-list.help.svg b/test/snapshots/termless/cli.native.socket-help-scan-list.svg similarity index 100% rename from test/native-snapshots/socket-help-scan-list.help.svg rename to test/snapshots/termless/cli.native.socket-help-scan-list.svg diff --git a/test/native-snapshots/socket-help-scan-metadata.help.svg b/test/snapshots/termless/cli.native.socket-help-scan-metadata.svg similarity index 100% rename from test/native-snapshots/socket-help-scan-metadata.help.svg rename to test/snapshots/termless/cli.native.socket-help-scan-metadata.svg diff --git a/test/native-snapshots/socket-help-scan-reach.help.svg b/test/snapshots/termless/cli.native.socket-help-scan-reach.svg similarity index 100% rename from test/native-snapshots/socket-help-scan-reach.help.svg rename to test/snapshots/termless/cli.native.socket-help-scan-reach.svg diff --git a/test/native-snapshots/socket-help-scan-report.help.svg b/test/snapshots/termless/cli.native.socket-help-scan-report.svg similarity index 100% rename from test/native-snapshots/socket-help-scan-report.help.svg rename to test/snapshots/termless/cli.native.socket-help-scan-report.svg diff --git a/test/native-snapshots/socket-help-scan-setup.help.svg b/test/snapshots/termless/cli.native.socket-help-scan-setup.svg similarity index 100% rename from test/native-snapshots/socket-help-scan-setup.help.svg rename to test/snapshots/termless/cli.native.socket-help-scan-setup.svg diff --git a/test/native-snapshots/socket-help-scan-view.help.svg b/test/snapshots/termless/cli.native.socket-help-scan-view.svg similarity index 100% rename from test/native-snapshots/socket-help-scan-view.help.svg rename to test/snapshots/termless/cli.native.socket-help-scan-view.svg diff --git a/test/native-snapshots/socket-help-scan.help.svg b/test/snapshots/termless/cli.native.socket-help-scan.svg similarity index 100% rename from test/native-snapshots/socket-help-scan.help.svg rename to test/snapshots/termless/cli.native.socket-help-scan.svg diff --git a/test/native-snapshots/socket-help-security.help.svg b/test/snapshots/termless/cli.native.socket-help-security.svg similarity index 100% rename from test/native-snapshots/socket-help-security.help.svg rename to test/snapshots/termless/cli.native.socket-help-security.svg diff --git a/test/native-snapshots/socket-help-threat-feed.help.svg b/test/snapshots/termless/cli.native.socket-help-threat-feed.svg similarity index 100% rename from test/native-snapshots/socket-help-threat-feed.help.svg rename to test/snapshots/termless/cli.native.socket-help-threat-feed.svg diff --git a/test/native-snapshots/socket-help-uninstall-completion.help.svg b/test/snapshots/termless/cli.native.socket-help-uninstall-completion.svg similarity index 100% rename from test/native-snapshots/socket-help-uninstall-completion.help.svg rename to test/snapshots/termless/cli.native.socket-help-uninstall-completion.svg diff --git a/test/native-snapshots/socket-help-uninstall.help.svg b/test/snapshots/termless/cli.native.socket-help-uninstall.svg similarity index 100% rename from test/native-snapshots/socket-help-uninstall.help.svg rename to test/snapshots/termless/cli.native.socket-help-uninstall.svg diff --git a/test/native-snapshots/socket-help-wrapper.help.svg b/test/snapshots/termless/cli.native.socket-help-wrapper.svg similarity index 100% rename from test/native-snapshots/socket-help-wrapper.help.svg rename to test/snapshots/termless/cli.native.socket-help-wrapper.svg diff --git a/test/native-snapshots/socket-help-yarn.help.svg b/test/snapshots/termless/cli.native.socket-help-yarn.svg similarity index 100% rename from test/native-snapshots/socket-help-yarn.help.svg rename to test/snapshots/termless/cli.native.socket-help-yarn.svg diff --git a/test/native-snapshots/socket-help.help.svg b/test/snapshots/termless/cli.native.socket-help.svg similarity index 100% rename from test/native-snapshots/socket-help.help.svg rename to test/snapshots/termless/cli.native.socket-help.svg diff --git a/test/native-snapshots/socket-manifest-dry-run.dry-run.svg b/test/snapshots/termless/cli.native.socket-manifest-dry-run.svg similarity index 100% rename from test/native-snapshots/socket-manifest-dry-run.dry-run.svg rename to test/snapshots/termless/cli.native.socket-manifest-dry-run.svg diff --git a/test/native-snapshots/socket-patch-apply-help.help.svg b/test/snapshots/termless/cli.native.socket-patch-apply-help.svg similarity index 100% rename from test/native-snapshots/socket-patch-apply-help.help.svg rename to test/snapshots/termless/cli.native.socket-patch-apply-help.svg diff --git a/test/native-snapshots/socket-patch-get-help.help.svg b/test/snapshots/termless/cli.native.socket-patch-get-help.svg similarity index 100% rename from test/native-snapshots/socket-patch-get-help.help.svg rename to test/snapshots/termless/cli.native.socket-patch-get-help.svg diff --git a/test/native-snapshots/socket-patch-list-help.help.svg b/test/snapshots/termless/cli.native.socket-patch-list-help.svg similarity index 100% rename from test/native-snapshots/socket-patch-list-help.help.svg rename to test/snapshots/termless/cli.native.socket-patch-list-help.svg diff --git a/test/native-snapshots/socket-patch-remove-help.help.svg b/test/snapshots/termless/cli.native.socket-patch-remove-help.svg similarity index 100% rename from test/native-snapshots/socket-patch-remove-help.help.svg rename to test/snapshots/termless/cli.native.socket-patch-remove-help.svg diff --git a/test/native-snapshots/socket-patch-repair-help.help.svg b/test/snapshots/termless/cli.native.socket-patch-repair-help.svg similarity index 100% rename from test/native-snapshots/socket-patch-repair-help.help.svg rename to test/snapshots/termless/cli.native.socket-patch-repair-help.svg diff --git a/test/native-snapshots/socket-patch-rollback-help.help.svg b/test/snapshots/termless/cli.native.socket-patch-rollback-help.svg similarity index 100% rename from test/native-snapshots/socket-patch-rollback-help.help.svg rename to test/snapshots/termless/cli.native.socket-patch-rollback-help.svg diff --git a/test/native-snapshots/socket-patch-scan-help.help.svg b/test/snapshots/termless/cli.native.socket-patch-scan-help.svg similarity index 100% rename from test/native-snapshots/socket-patch-scan-help.help.svg rename to test/snapshots/termless/cli.native.socket-patch-scan-help.svg diff --git a/test/native-snapshots/socket-patch-setup-help.help.svg b/test/snapshots/termless/cli.native.socket-patch-setup-help.svg similarity index 100% rename from test/native-snapshots/socket-patch-setup-help.help.svg rename to test/snapshots/termless/cli.native.socket-patch-setup-help.svg diff --git a/test/native-snapshots/socket-patch-version.version.svg b/test/snapshots/termless/cli.native.socket-patch-version.svg similarity index 100% rename from test/native-snapshots/socket-patch-version.version.svg rename to test/snapshots/termless/cli.native.socket-patch-version.svg diff --git a/test/native-snapshots/socket-scan-setup.canceled.svg b/test/snapshots/termless/cli.native.socket-scan-setup.canceled.svg similarity index 100% rename from test/native-snapshots/socket-scan-setup.canceled.svg rename to test/snapshots/termless/cli.native.socket-scan-setup.canceled.svg diff --git a/test/native-snapshots/socket-scan-setup.github-selected.svg b/test/snapshots/termless/cli.native.socket-scan-setup.github-selected.svg similarity index 100% rename from test/native-snapshots/socket-scan-setup.github-selected.svg rename to test/snapshots/termless/cli.native.socket-scan-setup.github-selected.svg diff --git a/test/native-snapshots/socket-scan-setup.menu.svg b/test/snapshots/termless/cli.native.socket-scan-setup.menu.svg similarity index 100% rename from test/native-snapshots/socket-scan-setup.menu.svg rename to test/snapshots/termless/cli.native.socket-scan-setup.menu.svg diff --git a/test/native-snapshots/socket-version.version.svg b/test/snapshots/termless/cli.native.socket-version.svg similarity index 100% rename from test/native-snapshots/socket-version.version.svg rename to test/snapshots/termless/cli.native.socket-version.svg diff --git a/test/native-snapshots/self-update-notice-standard.standard.svg b/test/snapshots/termless/self-update.notice-standard.svg similarity index 100% rename from test/native-snapshots/self-update-notice-standard.standard.svg rename to test/snapshots/termless/self-update.notice-standard.svg diff --git a/test/native-snapshots/self-update-notice-wide.wide.svg b/test/snapshots/termless/self-update.notice-wide.svg similarity index 100% rename from test/native-snapshots/self-update-notice-wide.wide.svg rename to test/snapshots/termless/self-update.notice-wide.svg diff --git a/test/native-snapshots/self-update-notice-wrapped.wrapped.svg b/test/snapshots/termless/self-update.notice-wrapped.svg similarity index 100% rename from test/native-snapshots/self-update-notice-wrapped.wrapped.svg rename to test/snapshots/termless/self-update.notice-wrapped.svg diff --git a/test/native-snapshots/self-update-suppressed.suppressed.svg b/test/snapshots/termless/self-update.suppressed.svg similarity index 100% rename from test/native-snapshots/self-update-suppressed.suppressed.svg rename to test/snapshots/termless/self-update.suppressed.svg diff --git a/test/snapshots/termless/termless.node-e-fixture.after-enter.svg b/test/snapshots/termless/termless.node-e-fixture.after-enter.svg new file mode 100644 index 000000000..827f69a95 --- /dev/null +++ b/test/snapshots/termless/termless.node-e-fixture.after-enter.svg @@ -0,0 +1,9 @@ + +Enter received + + + + + + + \ No newline at end of file diff --git a/test/snapshots/termless/termless.node-e-fixture.prompt.svg b/test/snapshots/termless/termless.node-e-fixture.prompt.svg new file mode 100644 index 000000000..d80160dd5 --- /dev/null +++ b/test/snapshots/termless/termless.node-e-fixture.prompt.svg @@ -0,0 +1,9 @@ + +PTY fixture + +> ready + + + + + \ No newline at end of file diff --git a/test/native-snapshots/native-analytics-tui.charts.svg b/test/snapshots/termless/tui.native.analytics.svg similarity index 100% rename from test/native-snapshots/native-analytics-tui.charts.svg rename to test/snapshots/termless/tui.native.analytics.svg diff --git a/test/native-snapshots/native-audit-log-tui.table.svg b/test/snapshots/termless/tui.native.audit-log.svg similarity index 100% rename from test/native-snapshots/native-audit-log-tui.table.svg rename to test/snapshots/termless/tui.native.audit-log.svg diff --git a/test/native-snapshots/native-threat-feed-tui.table.svg b/test/snapshots/termless/tui.native.threat-feed.svg similarity index 100% rename from test/native-snapshots/native-threat-feed-tui.table.svg rename to test/snapshots/termless/tui.native.threat-feed.svg diff --git a/test/unit/utils/self-update.terminal.test.mts b/test/termless/utils/self-update.test.mts similarity index 95% rename from test/unit/utils/self-update.terminal.test.mts rename to test/termless/utils/self-update.test.mts index 167f9e683..962a32003 100644 --- a/test/unit/utils/self-update.terminal.test.mts +++ b/test/termless/utils/self-update.test.mts @@ -11,7 +11,7 @@ import { captureCheckpoint, createRecording, expectTerminalAnimation, -} from '../../lib/terminal/animation.mts' +} from '../../lib/termless/animation.mts' const { loggerLog } = vi.hoisted(() => ({ loggerLog: vi.fn() })) @@ -27,7 +27,7 @@ vi.mock('@socketsecurity/registry/lib/logger', () => ({ logger: { log: loggerLog }, })) -const snapshotsDir = path.join(process.cwd(), 'test/native-snapshots') +const snapshotsDir = path.join(process.cwd(), 'test/snapshots/termless') const artifactsDir = process.env['SOCKET_CLI_NATIVE_TEST_ARTIFACTS'] ?? path.join(process.cwd(), 'build/native-test-artifacts') @@ -78,7 +78,7 @@ describe('self-update terminal notice screenshot', () => { expect(terminal.screen.getText()).not.toContain('Socket 1.0.0 → 1.1.0.') const checkpoint = await captureCheckpoint(terminal, 'suppressed') await expectTerminalAnimation(createRecording([checkpoint]), { - flow: 'self-update-suppressed', + flow: 'suppressed', snapshotsDir, artifactsDir, expectedSequence: ['suppressed'], @@ -107,7 +107,7 @@ async function captureNoticeAtWidth(cols: number, name: string): Promise { expect(terminal.screen.getText()).toContain('Socket 1.0.0 → 1.1.0.') const checkpoint = await captureCheckpoint(terminal, name) await expectTerminalAnimation(createRecording([checkpoint]), { - flow: `self-update-notice-${name}`, + flow: `notice-${name}`, snapshotsDir, artifactsDir, expectedSequence: [name], diff --git a/test/unit/lib/terminal/animation.test.mts b/test/unit/lib/termless/animation.test.mts similarity index 98% rename from test/unit/lib/terminal/animation.test.mts rename to test/unit/lib/termless/animation.test.mts index 32c8bb584..59a7e4084 100644 --- a/test/unit/lib/terminal/animation.test.mts +++ b/test/unit/lib/termless/animation.test.mts @@ -11,13 +11,13 @@ import { captureCheckpoint, createBlankCell, createRecording, - createTerminalAnimationSvg, + createTermlessAnimationSvg, emptyCell, expectTerminalAnimation, findLastOccupiedRow, isVisiblyOccupied, renderCaptured, -} from '../../../lib/terminal/animation.mts' +} from '../../../lib/termless/animation.mts' import type { AnimationFrame } from '@termless/core' @@ -37,7 +37,7 @@ describe('terminal animation recorder', () => { duration: 400, }, ] - const svg = createTerminalAnimationSvg(frames) + const svg = createTermlessAnimationSvg(frames) for (const text of ['frame-one', 'frame-two', 'frame-three']) { expect(svg).toContain(text) } diff --git a/test/unit/lib/optimize-svg.test.mts b/test/unit/lib/termless/svgo.test.mts similarity index 97% rename from test/unit/lib/optimize-svg.test.mts rename to test/unit/lib/termless/svgo.test.mts index d0160a789..0a83703d3 100644 --- a/test/unit/lib/optimize-svg.test.mts +++ b/test/unit/lib/termless/svgo.test.mts @@ -1,7 +1,7 @@ import { selectRasterizer } from '@termless/core' import { describe, expect, it } from 'vitest' -import { optimizeSvg } from '../../lib/optimize-svg.mts' +import { optimizeSvg } from '../../../lib/termless/svgo.mts' const extractStyle = (svg: string) => svg.match(/