JamesHenry / typescript-estree

:sparkles: A parser that converts TypeScript source code into an ESTree-compatible form
https://jameshenry.blog
Other
84 stars 13 forks source link

test: fix issues with collecting coverage from tests #84

Closed armano2 closed 5 years ago

armano2 commented 5 years ago

This PR changes way how tests are executed:


Why i need those changes, mainly i'm using Intellij Idea to develop code, and there is no way to get debugging right there without jest.config.js file.


we can now setup something like codecov to inform us if out tests are covering all cases.


with this configuration we don't need multiple jest.configs for tests, and we can use filters if we want to run only specific test files.

    "test": "jest",
    "unit-tests": "jest \"./tests/lib/.*\"",
    "ast-alignment-tests": "jest spec.ts",

example report: https://travis-ci.org/JamesHenry/typescript-estree/jobs/474526291#L486

jest
 PASS  tests/lib/semanticInfo.ts (12.458s)
 PASS  tests/lib/jsx.ts
 PASS  tests/ast-alignment/spec.ts
 PASS  tests/lib/semantic-diagnostics-enabled.ts
 PASS  tests/lib/tsx.ts
 PASS  tests/lib/parse.ts
 PASS  tests/lib/comments.ts
 PASS  tests/lib/typescript.ts
=============================== Coverage summary ===============================
Statements   : 96.23% ( 1071/1113 )
Branches     : 93.38% ( 889/952 )
Functions    : 96.36% ( 106/110 )
Lines        : 96.21% ( 1067/1109 )
================================================================================
Test Suites: 9 passed, 9 total
Tests:       1816 passed, 1816 total
Snapshots:   1268 passed, 1268 total
Time:        25.444s
Ran all test suites.

example of codecov report https://codecov.io/gh/armano2/typescript-estree/tree/52ce5ddbabf9bb582dfb05c459d902c1a6a8ed73

JamesHenry commented 5 years ago

:tada: This PR is included in version 9.0.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: