diff --git a/package.json b/package.json index 8abd21c..4a28337 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,8 @@ }, "scripts": { "build": "bun scripts/build.ts", - "build:docs": "typedoc src/index.ts" + "build:docs": "typedoc src/index.ts", + "pretest": "bun scripts/cleanup-test-data.ts", + "test": "bun test" } } diff --git a/scripts/cleanup-test-data.ts b/scripts/cleanup-test-data.ts new file mode 100755 index 0000000..0f4d3b5 --- /dev/null +++ b/scripts/cleanup-test-data.ts @@ -0,0 +1,13 @@ +import { rm, readdir } from "fs/promises"; +import { join as joinPaths } from "path"; + +// rm -f test/ignore/*.{js,json,txt} +// rm -f test/ignore/app-*.asar + +const ignoreDir = "test/ignore"; + +for (const file of await readdir(ignoreDir)) { + if (/\.(js|json|txt)$|^app-.+\.asar/.test(file)) { + await rm(joinPaths(ignoreDir, file)); + } +} diff --git a/test/cleanupTestData.sh b/test/cleanupTestData.sh deleted file mode 100755 index 8c93fdb..0000000 --- a/test/cleanupTestData.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -rm -f test/ignore/*.{js,json,txt} -rm -f test/ignore/app-*.asar