1
0

test-rust.mjs 630 B

123456789101112131415161718
  1. #!/usr/bin/env zx
  2. import 'zx/globals';
  3. import { cliArguments, workingDirectory } from '../utils.mjs';
  4. // Configure additional arguments here, e.g.:
  5. // ['--arg1', '--arg2', ...cliArguments()]
  6. const testArgs = cliArguments();
  7. const hasSolfmt = await which('solfmt', { nothrow: true });
  8. const sbfOutDir = path.join(workingDirectory, 'target', 'deploy');
  9. // Run the tests.
  10. cd(path.join(workingDirectory, 'clients', 'rust'));
  11. if (hasSolfmt) {
  12. await $`SBF_OUT_DIR=${sbfOutDir} cargo test --features "test-sbf" ${testArgs} 2>&1 | solfmt`;
  13. } else {
  14. await $`SBF_OUT_DIR=${sbfOutDir} cargo test --features "test-sbf" ${testArgs}`;
  15. }