diff --git a/.gitignore b/.gitignore index 90e2014e..33ba7b1d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ logo.pxd node_modules .parcel-cache dist +build generated .yarnrc.yml *.test.js diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..3c032078 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18 diff --git a/README.md b/README.md index 01eab8e0..a00db7b0 100644 --- a/README.md +++ b/README.md @@ -83,5 +83,5 @@ npm run watch # Runs the silverbullet server npm run server # Builds (and watches for changes) all builtin plugs (in packages/plugs) -npm run plugs +npm run plugs -- ``` diff --git a/package.json b/package.json index 8e494b3c..085c9801 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "plugs": "cd packages/plugs && npm run watch", "build-plugs": "cd packages/plugs && npm run build", "server": "nodemon -w packages/server/dist --exec silverbullet", - "test": "jest packages/*/dist/test", + "test": "jest packages/*/{dist,build}/test", "clean-build": "npm run clean && npm run build && npm i && npm run build-plugs", "publish-all": "npm publish --access public --ws" }, diff --git a/packages/plugos-silverbullet-syscall/syscall.ts b/packages/plugos-silverbullet-syscall/syscall.ts index b4d4e5ef..c23d9b69 100644 --- a/packages/plugos-silverbullet-syscall/syscall.ts +++ b/packages/plugos-silverbullet-syscall/syscall.ts @@ -2,4 +2,14 @@ declare global { function syscall(name: string, ...args: any[]): Promise; } +// This is the case when running tests only, so giving it a dummy syscall function +if (typeof self === "undefined") { + // @ts-ignore + self = { + syscall: (name: string, ...args: any[]) => { + throw new Error("Not implemented here"); + }, + }; +} + export const syscall = self.syscall; diff --git a/packages/plugos/environments/node_worker.ts b/packages/plugos/environments/node_worker.ts index 08df7142..0ce2e3ab 100644 --- a/packages/plugos/environments/node_worker.ts +++ b/packages/plugos/environments/node_worker.ts @@ -137,7 +137,7 @@ parentPort.on("message", (data: any) => { } pendingRequests.delete(syscallId); if (data.error) { - console.log("Got rejection", data.error); + // console.log("Got rejection", data.error); lookup.reject(new Error(data.error)); } else { lookup.resolve(data.result); diff --git a/packages/plugos/hooks/endpoint.test.ts b/packages/plugos/hooks/endpoint.test.ts index 40b4334d..2438867c 100644 --- a/packages/plugos/hooks/endpoint.test.ts +++ b/packages/plugos/hooks/endpoint.test.ts @@ -46,4 +46,5 @@ test("Run a plugos endpoint server", async () => { expect(resp.text).toBe(JSON.stringify([1, 2, 3])); }); server.close(); + await system.unloadAll(); }); diff --git a/packages/server/auth.test.ts b/packages/server/auth.test.ts index b33bd412..7855aaa6 100644 --- a/packages/server/auth.test.ts +++ b/packages/server/auth.test.ts @@ -9,7 +9,7 @@ beforeEach(async () => { db = knex({ client: "better-sqlite3", connection: { - filename: "test.db", + filename: "auth-test.db", }, useNullAsDefault: true, }); @@ -17,7 +17,7 @@ beforeEach(async () => { afterEach(async () => { db!.destroy(); - await unlink("test.db"); + await unlink("auth-test.db"); }); test("Test auth", async () => {