test.mjs 762 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env zx
  2. import 'zx/globals';
  3. import {
  4. cliArguments,
  5. getProgramFolders,
  6. workingDirectory,
  7. } from '../utils.mjs';
  8. // Save external programs binaries to the output directory.
  9. import './dump.mjs';
  10. // Configure additional arguments here, e.g.:
  11. // ['--arg1', '--arg2', ...cliArguments()]
  12. const testArgs = cliArguments();
  13. const hasSolfmt = await which('solfmt', { nothrow: true });
  14. // Test the programs.
  15. for (const folder of getProgramFolders()) {
  16. const manifestPath = path.join(workingDirectory, folder, 'Cargo.toml');
  17. if (hasSolfmt) {
  18. await $`RUST_LOG=error cargo test-sbf --manifest-path ${manifestPath} ${testArgs} 2>&1 | solfmt`;
  19. } else {
  20. await $`RUST_LOG=error cargo test-sbf --manifest-path ${manifestPath} ${testArgs}`;
  21. }
  22. }