test-unit.mjs 637 B

12345678910111213141516171819
  1. #!/usr/bin/env zx
  2. import { $, argv } from 'zx';
  3. $.stdio = 'inherit';
  4. const platform = argv._[0];
  5. const watch = argv.watch;
  6. // Prepare build and test arguments.
  7. const buildArgs = ['--config', `internals/tsup.config.tests.${platform}.ts`];
  8. const testArgs = ['--config', `../../node_modules/@kinobi-so/internals/ava.config.${platform}.mjs`];
  9. if (watch) {
  10. // Build and run the tests concurrently in watch mode.
  11. await $`concurrently "tsup ${buildArgs} --watch" "ava ${testArgs} --watch" --hide 0 --prefix none --kill-others`;
  12. } else {
  13. // Build and run the tests.
  14. await $`tsup ${buildArgs}`;
  15. await $`ava ${testArgs}`;
  16. }