mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 00:02:31 +00:00
refactor(test): move shell wrapper fixtures where they read as test data (#15363)
This commit is contained in:
@@ -18,3 +18,7 @@
|
||||
# source patch under xterm-src/ instead. The sibling patches stay diffable.
|
||||
/config/patches/@xterm__xterm@*.patch -diff
|
||||
/config/patches/xterm-src/*.patch text eol=lf
|
||||
# Generated wrapper fixtures: collapse them in the PR diff so they stop drowning
|
||||
# the reviewable change, and pin LF because they are compared byte-for-byte.
|
||||
# Not -diff: the shell diff is the review surface when a wrapper does change.
|
||||
/src/main/__tests__/shell-wrapper-snapshots/*.txt linguist-generated=true text eol=lf
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
# Shell wrapper snapshots
|
||||
|
||||
Generated test fixtures. **Do not edit by hand.**
|
||||
|
||||
Each `.txt` here is the byte-exact content of one shell startup file Orca writes
|
||||
into a pane's wrapper `ZDOTDIR`, captured per transport:
|
||||
|
||||
| | |
|
||||
| :--- | :--- |
|
||||
| `local-*` | local PTY |
|
||||
| `daemon-*` | daemon / SSH host |
|
||||
| `relay-*` | relay overlay |
|
||||
|
||||
Owned by [`../../shell-wrapper-generated-file-snapshot.test.ts`](../../shell-wrapper-generated-file-snapshot.test.ts),
|
||||
which drives the real wrapper entry points, reads the files back off disk and
|
||||
compares them here. The temp wrapper root is normalized to `<WRAPPER_ROOT>` —
|
||||
the only path-dependent bytes in the output.
|
||||
|
||||
## Why these exist
|
||||
|
||||
The three zsh generators were once copy-pasted and drifted, so a fix landed in
|
||||
one transport and silently missed the other two. These pin all three at once, so
|
||||
drift shows up as a reviewable shell diff instead of hiding in a TypeScript
|
||||
template literal.
|
||||
|
||||
## Regenerating
|
||||
|
||||
Run the test and review the resulting diff:
|
||||
|
||||
```sh
|
||||
npx vitest run --config config/vitest.config.ts src/main/shell-wrapper-generated-file-snapshot.test.ts
|
||||
```
|
||||
|
||||
⚠️ `toMatchFileSnapshot` **rewrites these files on mismatch when run locally** —
|
||||
only CI fails. So a passing local run proves nothing on its own: always
|
||||
`git diff` this directory afterwards, and treat any change as a real behavior
|
||||
change to what users' shells execute until you have explained it.
|
||||
@@ -4,6 +4,9 @@
|
||||
*
|
||||
* Why: the zsh generators were unified behind one builder; these fixtures were
|
||||
* captured from the pre-unification code so any drift shows up as a diff.
|
||||
*
|
||||
* Fixtures live in ./__tests__/shell-wrapper-snapshots/ — see the README there
|
||||
* before accepting a rewrite; a local run updates them silently.
|
||||
*/
|
||||
import { mkdtempSync, readFileSync, rmSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
@@ -33,7 +36,7 @@ const WRAPPER_FILES = [
|
||||
['bash-rcfile', join('bash', 'rcfile')]
|
||||
] as const
|
||||
|
||||
const SNAPSHOT_DIR = join(__dirname, 'shell-wrapper-snapshots')
|
||||
const SNAPSHOT_DIR = join(__dirname, '__tests__', 'shell-wrapper-snapshots')
|
||||
|
||||
// Why: the wrapper root is a temp dir per run, and the baked ZDOTDIR literal is
|
||||
// the only path-dependent byte in the output; pin it to a stable placeholder.
|
||||
|
||||
Reference in New Issue
Block a user