Giter VIP home page Giter VIP logo

Comments (10)

jack-guy avatar jack-guy commented on May 28, 2024 3

Hmm, here's my nyc config now:

{
    "include": [
      "src/**/*.ts"
    ],
    "exclude": [
      "**/*.d.ts"
    ],
    "extension": [
      ".ts"
    ],
    "require": [
      "ts-node/register"
    ],
    "reporter": [
      "html",
      "text"
    ],
    "sourceMap": false,
    "instrument": true,
    "all": true
}

This seems to find all of my files (the require option is necessary in addition to the all key), but does not register my coverage for any except one of the files.

from ava-ts.

jack-guy avatar jack-guy commented on May 28, 2024 3

@sigmasoldi3r Ava supports .ts files now (and coverage reports are working for me too).

from ava-ts.

andywer avatar andywer commented on May 28, 2024 1

Thanks for sharing, @Harangue! :)

Runs without crashing for me, too, but I don't get any coverage in my test project... (Source files are matched by src/**/*.ts in my project as well)

bildschirmfoto 2018-01-28 um 10 35 02

from ava-ts.

andywer avatar andywer commented on May 28, 2024

Hey @wbhob. Excellent point...

I played around and tried a bunch of stuff, but the bad news is I am currently not able to get working coverage reports either 😕

Some of the code transparently added by TypeScript or NYC just crashs with TypeError: Promise resolver undefined is not a function.

So this is an unsolved issue as of now.

from ava-ts.

jack-guy avatar jack-guy commented on May 28, 2024

I got this working! Here's my .nycrc

{
  "extension": [
    ".ts",
    ".tsx"
  ],
  "include": ["src/**/*.ts"],
  "reporter": [
    "text",
    "html"
  ],
  "cache": true,
  "sourceMap": false,
  "instrument": false
}

Then I run

nyc ava-ts tests/ --verbose

I haven't had any issues with this method whatsoever. :)

from ava-ts.

jack-guy avatar jack-guy commented on May 28, 2024

Yeah @andywer, it seems I spoke too soon. I got it to run test coverage for all of my files once, somehow, but never again after that. I've been looking at this blog post to try to uncover what's wrong but I'm afraid I don't understand all of the mechanics of how ava reports to instanbul.

from ava-ts.

sigmasoldi3r avatar sigmasoldi3r commented on May 28, 2024

in my case NYC is ignoring the coverage from tests

$ nyc ava-ts tests --verbose

  √ OptionalMap.ts » Set value adds an entry
  √ OptionalMap.ts » Initializer adds entries
  √ OptionalMap.ts » Get valid optionals
  √ OptionalMap.ts » Setting values increments the size
  √ OptionalMap.ts » Clear method removes entries
  √ OptionalMap.ts » Delete drops entry
  √ OptionalMap.ts » Entries iterator
  √ OptionalMap.ts » Values iterator
  √ OptionalMap.ts » Keys iterator
  √ OptionalMap.ts » For each iterator
  √ Optional.ts » If value is present
  √ Optional.ts » Unsafe get value
  √ Optional.ts » Safe get orElse value
  √ Optional.ts » Throw exception on no value
  √ Optional.ts » Safe get callback

  15 tests passed

----------|----------|----------|----------|----------|-------------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files |        0 |        0 |        0 |        0 |                   |
----------|----------|----------|----------|----------|-------------------|
Done in 14.63s.

from ava-ts.

creaux avatar creaux commented on May 28, 2024

@jack-guy yes but if you are using babel 7 + typescript then you are still tends on ava-ts. I didn't find different solution. Can you be more explicit about support of ts files?

from ava-ts.

dougmolineux avatar dougmolineux commented on May 28, 2024

When I exclude:

"exclude": [
      "**/*.d.ts"
    ],

I am seeing this error:

TSError: ⨯ Unable to compile TypeScript
src/app.ts (84,29): Argument of type 'string | undefined' is not assignable to parameter of type 'string'.

from ava-ts.

andywer avatar andywer commented on May 28, 2024

@dougmolineux Still hard to tell if this has to do with AVA-TS or just TypeScript... Are you talking about an exclude in the tsconfig.json or in the ava config in the package.json?

from ava-ts.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.