add tests to tsconfig so we get early warning via tsc watch when stuff breaks

This commit is contained in:
Ladd Hoffman 2024-12-27 13:57:13 -06:00
parent 8fdec5da11
commit ad3c00638c
3 changed files with 27 additions and 46 deletions

View File

@ -2,60 +2,40 @@
> rhizome-node@0.1.0 test > rhizome-node@0.1.0 test
> jest --coverage > jest --coverage
PASS __tests__/lossless.ts
PASS __tests__/peer-address.ts PASS __tests__/peer-address.ts
FAIL __tests__/lossy.ts PASS __tests__/lossless.ts
● Test suite failed to run PASS __tests__/lossy.ts
PASS __tests__/run/001-single-node.ts
__tests__/lossy.ts:66:36 - error TS2345: Argument of type '(losslessView: LosslessViewMany) => Summary' is not assignable to parameter of type 'Resolver'. PASS __tests__/run/002-two-nodes.ts
Type 'Summary' is not assignable to type 'LossyViewMany'. ----------------------|---------|----------|---------|---------|----------------------------
Property 'roles' is incompatible with index signature.
Type 'Role[]' is missing the following properties from type 'LossyViewOne<Properties>': id, properties
66 const result = lossy.resolve(resolver);
   ~~~~~~~~
FAIL __tests__/run/002-two-nodes.ts
● Run can create a record on app0 and read it on app1
SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
at JSON.parse (<anonymous>)
FAIL __tests__/run/001-single-node.ts
● Run can put a new user and fetch it
SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
at JSON.parse (<anonymous>)
----------------------|---------|----------|---------|---------|-------------------------------------------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------------------|---------|----------|---------|---------|------------------------------------------------------- ----------------------|---------|----------|---------|---------|----------------------------
All files | 79.08 | 44.65 | 78.26 | 79.29 | All files | 87.12 | 61.48 | 83.91 | 87.54 |
src | 79.55 | 47.05 | 77.96 | 79.45 | src | 93.04 | 82.02 | 92 | 93.18 |
collection.ts | 53.76 | 26.66 | 57.89 | 54.02 | 54-123,131-135,155,195,226,233,246 collection.ts | 89.47 | 66.66 | 80 | 91.54 | 59-67,99,139
config.ts | 100 | 72.41 | 100 | 100 | 7-10,12,15,17-20 config.ts | 94.44 | 89.65 | 50 | 94.44 | 22
deltas.ts | 77.77 | 62.5 | 84.61 | 77.77 | 42-46,64-73 delta.ts | 100 | 100 | 100 | 100 |
entity.ts | 25 | 100 | 0 | 25 | 17-21 deltas.ts | 66.66 | 60 | 78.57 | 66.66 | 33-36,48-52,61-62,70-79
http-api.ts | 51.51 | 13.04 | 33.33 | 51.51 | 32,37,44-60,66,79-80,85-92,97,117,122-128,136,141-147
lossless.ts | 100 | 100 | 100 | 100 | lossless.ts | 100 | 100 | 100 | 100 |
lossy.ts | 43.75 | 0 | 50 | 46.66 | 26-29,37-40 lossy.ts | 100 | 85.71 | 100 | 100 | 48
node.ts | 100 | 100 | 100 | 100 | node.ts | 100 | 100 | 100 | 100 |
peers.ts | 100 | 100 | 100 | 100 | peers.ts | 96.82 | 100 | 100 | 96.61 | 126-127
pub-sub.ts | 100 | 100 | 100 | 100 | pub-sub.ts | 100 | 100 | 100 | 100 |
request-reply.ts | 95.65 | 0 | 100 | 95.34 | 46,59 request-reply.ts | 95.65 | 0 | 100 | 95.34 | 46,59
typed-collection.ts | 100 | 100 | 100 | 100 | typed-collection.ts | 100 | 100 | 100 | 100 |
types.ts | 81.25 | 100 | 85.71 | 81.25 | 11-14 types.ts | 100 | 100 | 100 | 100 |
src/http | 66.25 | 13.04 | 52.17 | 66.66 |
api.ts | 56.41 | 0 | 42.85 | 56.75 | 15,20,27-43,49,66-67,82-88
html.ts | 56.52 | 0 | 40 | 56.52 | 17-18,23-30,35
index.ts | 100 | 75 | 100 | 100 | 36
src/util | 70.68 | 30.43 | 77.77 | 73.58 | src/util | 70.68 | 30.43 | 77.77 | 73.58 |
md-files.ts | 70.68 | 30.43 | 77.77 | 73.58 | 53-57,74-77,98-102,116-123 md-files.ts | 70.68 | 30.43 | 77.77 | 73.58 | 53-57,74-77,98-102,116-123
util | 100 | 100 | 100 | 100 | util | 100 | 100 | 100 | 100 |
app.ts | 100 | 100 | 100 | 100 | app.ts | 100 | 100 | 100 | 100 |
----------------------|---------|----------|---------|---------|------------------------------------------------------- ----------------------|---------|----------|---------|---------|----------------------------
Test Suites: 3 failed, 2 passed, 5 total
Tests: 2 failed, 4 passed, 6 total Test Suites: 5 passed, 5 total
Tests: 7 passed, 7 total
Snapshots: 0 total Snapshots: 0 total
Time: 3.777 s, estimated 5 s Time: 4.47 s
Ran all test suites. Ran all test suites.

View File

@ -12,7 +12,8 @@
}, },
"jest": { "jest": {
"testEnvironment": "node", "testEnvironment": "node",
"preset": "ts-jest" "preset": "ts-jest",
"roots": ["__tests__/"]
}, },
"author": "Taliesin (Ladd) <ladd@dgov.io>", "author": "Taliesin (Ladd) <ladd@dgov.io>",
"license": "Unlicense", "license": "Unlicense",

View File

@ -13,6 +13,6 @@
"skipLibCheck": true, "skipLibCheck": true,
"forceConsistentCasingInFileNames": true "forceConsistentCasingInFileNames": true
}, },
"include": ["src/**/*", "examples/**/*"], "include": ["src/**/*", "examples/**/*", "__tests__/**/*"],
"exclude": ["node_modules"] "exclude": ["node_modules"]
} }