/** * Regression: vendored `bare-discord-js` must resolve on the Bare host the same way as * `executeKernel` (ctx.bare.discordJS). Executed by **brittle-bare** only — see package.json * `test` / `test:bare`. Skips under plain Node if accidentally invoked. */ import test from 'brittle' import { ensureGlobalRequireForCtxBareHostImports } from './lib/bare-os-ctx-bare.js' import { loadBareDiscordJs } from './lib/bare-discord-js-loader.js' function bareRuntime() { if (typeof globalThis.Bare !== 'undefined') return true const v = globalThis.process?.versions return !!(v && typeof v.bare === 'string') } test('boot parity: ctx.bare.discordJS loads (ensureGlobalRequire + loadBareDiscordJs)', async (t) => { if (!bareRuntime()) { t.pass('skip — Bare runtime only (npm run test:bare -w bare-os-booter)') return } await ensureGlobalRequireForCtxBareHostImports() /** @type {Record} */ const bareLibrary = {} if (bareLibrary.discordJS === undefined) { const dj = await loadBareDiscordJs(null) if (dj !== undefined) bareLibrary.discordJS = dj } t.ok( bareLibrary.discordJS != null, 'bare-discord-js resolved (mirrors executeKernel after ensureGlobalRequire)' ) const d = /** @type {Record} */ (bareLibrary.discordJS) t.ok( typeof d.Client === 'function', 'discord.js Client is exposed on ctx.bare.discordJS' ) })