test-unit.mjs 514 B

123456789101112131415161718192021
  1. import { execSync } from "node:child_process";
  2. import path from "node:path";
  3. const jestBinFilePath = path.join(
  4. import.meta.dirname,
  5. "node_modules",
  6. ".bin",
  7. "jest",
  8. );
  9. // necessary evil to allow all Jest users
  10. // to benefit from ESM imports and use
  11. // our shared configs (especially for React component tests)
  12. execSync(
  13. `NODE_OPTIONS="--experimental-vm-modules" '${jestBinFilePath}' ${process.argv.slice(2).join(" ")}`.trim(),
  14. {
  15. cwd: process.cwd(),
  16. shell: true,
  17. stdio: "inherit",
  18. },
  19. );