From 9ed27f317571dc9513c2b1980e45f911888a7c84 Mon Sep 17 00:00:00 2001 From: Matthew Wright Date: Mon, 3 Jan 2022 15:28:56 -0700 Subject: [PATCH] cleanup --- .github/workflows/test.yml | 24 ++++++++++++++++++++++++ .travis.yml | 6 ------ README.md | 3 --- package.json | 10 ++++------ src/Pico.ts | 2 +- src/PicoFramework.ts | 2 +- test/cleanQuery.ts | 29 +++++++++++++++-------------- 7 files changed, 45 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..c09b987 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,24 @@ +name: Test + +on: push + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + node-version: + - lts/* # LTS version + - "17" # latest version + os: [ubuntu-latest, macOS-latest, windows-latest] + + steps: + - uses: actions/checkout@v2 + - name: Node ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + + - run: npm run setup + - run: npm test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3815911..0000000 --- a/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: node_js -node_js: - - "node" # latest / current - - "lts/*" - -after_success: npm run report-coverage diff --git a/README.md b/README.md index fb30be1..0c1d654 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,5 @@ # pico-framework -[![Build Status](https://travis-ci.org/Picolab/pico-framework.svg)](https://travis-ci.org/Picolab/pico-framework) -[![codecov](https://codecov.io/gh/Picolab/pico-framework/branch/master/graph/badge.svg)](https://codecov.io/gh/Picolab/pico-framework) - A framework for building actor-based, people-centric systems. (pico = PersIstent Compute Objects) ## Why Picos? diff --git a/package.json b/package.json index 29a2633..a4d358c 100644 --- a/package.json +++ b/package.json @@ -34,8 +34,7 @@ "scripts": { "prepublish": "npm run build", "build": "rm -rf dist && tsc", - "test": "nyc ava", - "report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov" + "test": "nyc ava" }, "dependencies": { "charwise": "^3.0.1", @@ -51,11 +50,10 @@ "@types/abstract-leveldown": "^5.0.1", "@types/levelup": "^4.3.0", "@types/lodash": "^4.14.157", - "ava": "^3.10.1", - "codecov": "^3.7.1", + "ava": "^4.0.0", "nyc": "^15.1.0", - "ts-node": "^8.10.2", - "typescript": "^3.9.7" + "ts-node": "^10.4.0", + "typescript": "^4.5.4" }, "ava": { "extensions": [ diff --git a/src/Pico.ts b/src/Pico.ts index 1a917bc..44118e5 100644 --- a/src/Pico.ts +++ b/src/Pico.ts @@ -423,7 +423,7 @@ export class Pico { let data: any; try { data = await this.pf.db.get(["entvar", this.id, rid, name]); - } catch (err) { + } catch (err: any) { if (err.notFound) { return null; } diff --git a/src/PicoFramework.ts b/src/PicoFramework.ts index 74600c3..5d1262d 100644 --- a/src/PicoFramework.ts +++ b/src/PicoFramework.ts @@ -160,7 +160,7 @@ export class PicoFramework { let rootId: string | null; try { rootId = await this.db.get(["root-pico"]); - } catch (err) { + } catch (err: any) { if (err.notFound) { rootId = null; } else { diff --git a/test/cleanQuery.ts b/test/cleanQuery.ts index 5194a9f..c43094f 100644 --- a/test/cleanQuery.ts +++ b/test/cleanQuery.ts @@ -1,7 +1,7 @@ import test from "ava"; import { cleanQuery } from "../src/PicoQuery"; -test("query = cleanQuery(query)", function(t) { +test("query = cleanQuery(query)", function (t) { try { cleanQuery(null); t.fail("should throw"); @@ -50,13 +50,13 @@ test("query = cleanQuery(query)", function(t) { cleanQuery({ eci: "eci123", rid: "foo", - name: "bar" + name: "bar", }), { eci: "eci123", rid: "foo", name: "bar", - args: {} + args: {}, } ); @@ -66,13 +66,13 @@ test("query = cleanQuery(query)", function(t) { eci: "eci123", rid: "foo", name: "bar", - args: args + args: args, }); t.deepEqual(query, { eci: "eci123", rid: "foo", name: "bar", - args: args + args: args, }); t.deepEqual(query.args, args, "they should match before query.args mutates"); query.args.what = "blah"; @@ -84,13 +84,13 @@ test("query = cleanQuery(query)", function(t) { eci: " eci123 ", rid: " foo\n ", name: " \t bar ", - args: { " foo ": " don't trim these " } + args: { " foo ": " don't trim these " }, }), { eci: "eci123", rid: "foo", name: "bar", - args: { " foo ": " don't trim these " } + args: { " foo ": " don't trim these " }, } ); @@ -100,13 +100,13 @@ test("query = cleanQuery(query)", function(t) { eci: "eci123", rid: "foo", name: "bar", - timestamp: new Date() + timestamp: new Date(), }), { eci: "eci123", rid: "foo", name: "bar", - args: {} + args: {}, } ); @@ -116,13 +116,13 @@ test("query = cleanQuery(query)", function(t) { eci: "eci123", rid: "foo", name: "bar", - for_rid: "rid" + for_rid: "rid", }), { eci: "eci123", rid: "foo", name: "bar", - args: {} + args: {}, } ); @@ -131,7 +131,7 @@ test("query = cleanQuery(query)", function(t) { eci: "eci123", rid: "foo", name: "bar", - args + args, }).args; } @@ -146,6 +146,7 @@ test("query = cleanQuery(query)", function(t) { const a = { one: 2 }; const b = cleanArgs(a); t.false(a === b, "must be a clone"); + // @ts-ignore t.deepEqual(a, b); b.extra = 3; t.notDeepEqual(a, b); @@ -153,7 +154,7 @@ test("query = cleanQuery(query)", function(t) { t.deepEqual( cleanArgs({ one: 2, - three: function() {} + three: function () {}, }), { one: 2 }, "remove non-jsonable things" @@ -165,7 +166,7 @@ test("query = cleanQuery(query)", function(t) { "args normalize to JSON null's" ); - (function(a, b) { + (function (a, b) { t.deepEqual( cleanArgs(arguments), { "0": "foo", "1": "bar" },