borkshop / kni

An interactive story language in JavaScript inspired by Inkle’s Ink
MIT License
80 stars 10 forks source link

Improve test coverage #49

Open jcorbin opened 3 years ago

jcorbin commented 3 years ago

Current "100" strategy is misleading, since those numbers were achieve by copious use of ignore exceptions, and never included all package sources.

jcorbin commented 3 years ago

Here's where we're at under the harsh lens of "no ignores, all sources":

 $ npx nyc --all npm test

> kni@4.0.3 test
> node -- test.js

-----------------------|---------|----------|---------|---------|-----------------------------------------------------------------------------------------------
File                   | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-----------------------|---------|----------|---------|---------|-----------------------------------------------------------------------------------------------
All files              |   77.28 |     77.7 |   79.17 |   77.28 |
 console.js            |     100 |      100 |     100 |     100 |
 document.js           |       0 |        0 |       0 |       0 | 3-154
 engine-test.js        |   84.25 |    66.67 |     100 |   84.25 | 113-114,119-120,133-134,137-138,141-142,153-154,167,177-183
 engine.js             |   89.43 |    90.57 |    90.2 |   89.61 | 72,76-78,81-82,91,110-111,114-115,286,315-316,371-372,375-376,379-380,427,483,536-547,615-625
 evaluate.js           |   98.08 |     96.3 |     100 |   97.98 | 31,39
 excerpt.js            |   54.35 |    55.17 |   53.85 |   53.41 | 19,26-46,106-114,148-156,166-200
 grammar.js            |   98.11 |    97.44 |   99.29 |   98.11 | 25,43,1112,1137-1138,1158-1159,1293-1294,1316-1317,1387-1388,1601
 html.js               |       0 |        0 |       0 |       0 | 3-53
 inline-lexer-test.js  |   89.09 |       80 |     100 |   89.09 | 19-23,36
 inline-lexer.js       |   99.04 |    98.33 |     100 |   99.04 | 33
 kni.js                |       0 |        0 |       0 |       0 | 4-315
 link.js               |   94.44 |      100 |     100 |   94.12 | 52-53
 outline-lexer-test.js |   84.21 |       75 |     100 |   84.21 | 15-19,32
 outline-lexer.js      |   96.97 |    93.75 |     100 |   96.88 | 24
 parser.js             |      80 |    66.67 |     100 |      80 | 14,17
 path.js               |     100 |      100 |     100 |     100 |
 readline.js           |       0 |        0 |       0 |       0 | 3-144
 scanner.js            |   96.83 |       90 |     100 |   96.77 | 41,85
 scope.js              |     100 |      100 |     100 |     100 |
 story.js              |      99 |       50 |     100 |      99 | 16
 template.js           |       0 |        0 |       0 |       0 | 3-78
 test.js               |     100 |      100 |     100 |     100 |
 translate-json.js     |       0 |      100 |       0 |       0 | 2-4
 verify.js             |   95.65 |    92.86 |     100 |   95.65 | 57-60
 wrapper.js            |      80 |      100 |   71.43 |   82.05 | 16-18,65-68
-----------------------|---------|----------|---------|---------|-----------------------------------------------------------------------------------------------

Without --all we're in the low 90%s ( see #50 )

After #48 we'll at least have coverage of kni.js and maybe others like readline.js

Past that we can add file exclusions for the browser bits, until we can add something like a fake dom or headless browser test.