mirror of
https://github.com/stablyai/orca.git
synced 2026-09-21 16:02:20 +00:00
26 lines
1.1 KiB
JavaScript
26 lines
1.1 KiB
JavaScript
import { createHash } from 'node:crypto'
|
|
import { readFileSync } from 'node:fs'
|
|
import { join, resolve } from 'node:path'
|
|
import { parseAllDocuments } from 'yaml'
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
const projectDir = resolve(import.meta.dirname, '../..')
|
|
|
|
describe('Windows process-tree patch contract', () => {
|
|
it('keeps the patch LF-only and hash-synced with the lockfile', () => {
|
|
const patchBytes = readFileSync(
|
|
join(projectDir, 'config/patches/@vscode__windows-process-tree@0.8.0.patch')
|
|
)
|
|
// pnpm hashes patches CRLF-normalized, so CR bytes cannot affect install
|
|
// behavior; keep the file LF-only so the bytes match main and diff clean.
|
|
expect(patchBytes.includes(0x0d)).toBe(false)
|
|
const patchHash = createHash('sha256')
|
|
.update(patchBytes.toString('utf8').replaceAll('\r\n', '\n'))
|
|
.digest('hex')
|
|
const lockfile = parseAllDocuments(readFileSync(join(projectDir, 'pnpm-lock.yaml'), 'utf8'))
|
|
.map((document) => document.toJS())
|
|
.find((document) => document.patchedDependencies)
|
|
expect(lockfile.patchedDependencies['@vscode/windows-process-tree@0.8.0']).toBe(patchHash)
|
|
})
|
|
})
|