1
0

node-version-check.test.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * Pin the Node-25 block banner content. The banner replaced a soft
  3. * `console.warn` because the warning was scrolling off-screen before
  4. * the OOM crash 30 seconds later, generating duplicate bug reports
  5. * (#54, #81, #140). The recipe and override env var below are
  6. * load-bearing — if any of them get edited away, this test catches it.
  7. */
  8. import { describe, it, expect } from 'vitest';
  9. import { buildNode25BlockBanner } from '../src/bin/node-version-check';
  10. describe('buildNode25BlockBanner', () => {
  11. it('embeds the reported Node version in the header', () => {
  12. expect(buildNode25BlockBanner('25.9.0')).toContain(
  13. 'Unsupported Node.js version: 25.9.0'
  14. );
  15. });
  16. it('names the V8 turboshaft WASM root cause and the OOM symptom', () => {
  17. const banner = buildNode25BlockBanner('25.7.0');
  18. expect(banner).toContain('V8 WASM JIT');
  19. expect(banner).toContain('turboshaft');
  20. expect(banner).toContain('Fatal process out of memory: Zone');
  21. });
  22. it('points users to Node 22 LTS via nvm and Homebrew', () => {
  23. const banner = buildNode25BlockBanner('25.7.0');
  24. expect(banner).toContain('Node.js 22 LTS');
  25. expect(banner).toContain('nvm install 22');
  26. expect(banner).toContain('brew install node@22');
  27. });
  28. it('documents the CODEGRAPH_ALLOW_UNSAFE_NODE override', () => {
  29. const banner = buildNode25BlockBanner('25.7.0');
  30. expect(banner).toContain('CODEGRAPH_ALLOW_UNSAFE_NODE=1');
  31. });
  32. it('links to issue #81 for the root-cause writeup', () => {
  33. expect(buildNode25BlockBanner('25.7.0')).toContain(
  34. 'github.com/colbymchenry/codegraph/issues/81'
  35. );
  36. });
  37. });