Files
orca/config/scripts/orcad-distribution/server-bundle/orcad-linear-sdk-package.test.mjs
Neil 9bd6272fdf refactor(tooling): organize build, CI, and test owners (#38130)
* refactor(tooling): organize test runtime and maintenance owners

* test(tooling): preserve relocated runtime fixture dependency edges

* refactor(tooling): preserve xterm routing owner checks

* ci(tooling): include routing owner in sparse checkout

* test(tooling): preserve copied workflow dependency closures

* fix(tooling): normalize hashed JSON assets in release parity

* fix(tooling): distinguish asset aliases from literal references

* fix(tooling): frame normalized asset reference payloads

* fix(tooling): normalize decoded JSON asset references

* refactor(tooling): organize build, CI and release owners

* fix(tooling): align moved generator and workflow path contracts

* fix(tooling): update generated plugin bundle owner banners

* test(tooling): create relocated mobile verifier fixture directories

* test(tooling): copy headless detector dependency closure

* test(tooling): align native batch policy fixtures with owner path

* fix(tooling): link moved reliability command to historical evidence

* fix(tooling): preserve nested sandbox owners and canonical guide source

* fix(tooling): target release version owners in checkout fixture
2026-11-04 21:08:19 -08:00

52 lines
1.8 KiB
JavaScript

import { mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterAll, beforeAll, expect, it } from 'vitest'
import { runProcessSync } from '@orca/process-host'
import {
ORCAD_ARTIFACTS,
ORCAD_LINEAR_SDK_ENTRY,
ORCAD_SERVER_ENTRY_FILENAME
} from '../../../../src/shared/orcad-artifacts.ts'
import { stageOrcadLinearSdk } from './orcad-linear-sdk-package.mjs'
const root = join(import.meta.dirname, '../../..', '..')
// Outside the repo, so Node cannot fall back to the checkout's node_modules.
const deployment = realpathSync(mkdtempSync(join(tmpdir(), 'orcad-linear-sdk-')))
beforeAll(async () => {
await stageOrcadLinearSdk(root, deployment)
}, 60_000)
afterAll(() => {
rmSync(deployment, { recursive: true, force: true })
})
it("resolves linear-sdk.ts's lazy require from the deployed server under plain Node", () => {
expect(ORCAD_ARTIFACTS.map((artifact) => artifact.filename)).toContain(ORCAD_LINEAR_SDK_ENTRY)
const server = join(deployment, ORCAD_SERVER_ENTRY_FILENAME)
writeFileSync(
server,
`const load = require('node:module').createRequire(__filename);
const sdk = load('@linear/sdk');
console.log(JSON.stringify({
resolved: load.resolve('@linear/sdk'),
client: typeof sdk.LinearClient,
authError: typeof sdk.AuthenticationLinearError
}));`
)
const loaded = runProcessSync({
program: process.execPath,
args: [server],
cwd: deployment,
env: { ORCA_BACKGROUND_LAUNCH: '1' },
timeoutMs: 30_000
})
expect(loaded.code, loaded.stderr.slice(-2_000)).toBe(0)
expect(JSON.parse(loaded.stdout.trim())).toEqual({
resolved: join(deployment, ORCAD_LINEAR_SDK_ENTRY),
client: 'function',
authError: 'function'
})
}, 40_000)