Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

test(server): watch mode (#2893)

Alex Yang92f378aefcb9
diff --git a/apps/server/package.json b/apps/server/package.json
index 25874ddab7..837c9a0256 100644
--- a/apps/server/package.json
+++ b/apps/server/package.json
@@ -10,6 +10,7 @@
"scripts": {
"dev": "nodemon ./src/index.ts",
"test": "yarn exec ts-node-esm ./scripts/run-test.ts all",
+ "test:watch": "yarn exec ts-node-esm ./scripts/run-test.ts all --watch",
"test:coverage": "c8 yarn exec ts-node-esm ./scripts/run-test.ts all",
"postinstall": "prisma generate"
},
diff --git a/apps/server/scripts/run-test.ts b/apps/server/scripts/run-test.ts
index 403c886c01..7c4e6067de 100755
--- a/apps/server/scripts/run-test.ts
+++ b/apps/server/scripts/run-test.ts
@@ -12,7 +12,13 @@ const root = fileURLToPath(new URL('..', import.meta.url));
const testDir = resolve(root, 'src', 'tests');
const files = await readdir(testDir);
-const sharedArgs = [...pkg.nodemonConfig.nodeArgs, '--test'];
+const watchMode = process.argv.includes('--watch');
+
+const sharedArgs = [
+ ...pkg.nodemonConfig.nodeArgs,
+ '--test',
+ watchMode ? '--watch' : '',
+];
const env = {
PATH: process.env.PATH,