Code Monkey home page Code Monkey logo

jest-ratchet's People

Contributors

dependabot[bot] avatar greenkeeper[bot] avatar markis avatar stephahart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jest-ratchet's Issues

Error: watch <folder>/coverage ENOENT

Error: watch /coverage ENOENT
[0] at exports._errnoException (util.js:1020:11)
[0] at FSWatcher.start (fs.js:1451:19)
[0] at Object.fs.watch (fs.js:1478:11)
[0] at JestRatchet.onRunComplete (/node_modules/jest-ratchet/index.js:118:28)
[0] at /node_modules/jest-cli/build/ReporterDispatcher.js:62:24
[0] at next (native)
[0] at step (/node_modules/jest-cli/build/ReporterDispatcher.js:1:260)
[0] at /node_modules/jest-cli/build/ReporterDispatcher.js:1:420
[0] at process._tickCallback (internal/process/next_tick.js:109:7)

Race condition

When jest executes onRunComplete coverage hasn't be evaluated yet, so the new coverage summary hasn't been written to the file.

Maybe there should be a watcher that watches for the coverage to get updated and then updates the threshold after the new coverage has been written.

ratcheting with glob threshold coverage

Is it possible to use jest-ratchet when you have glob coverageThresholds setup along with global thresholds, currently I am not seeing thresholds update when using glob patterns
example:

"./src/util": {
    "functions": 70,
    "lines": 70,
    "statements": 70
}

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

Adding support for Folder level ratcheting

In jest config, we can define multiple paths under "coverageThreshold" and although jest checks for these coverages, jest-ratchet does not update these values.

Is this something which is already supported? If not, I have done these changes locally on my project and would love to create a PR for the same in this project to add the support.

Working with vscode-jest

I'm using vscode-jest to automatically run related tests as files are changed. It has the unwanted side effect of updating the coverage to reflect only the changed files. Jest-ratchet has no way of knowing it's a partial coverage report, so it updates the global threshold to reflect the partial result.

In the midst of filing a bug I found a work-around: add the following to VSCode's settings.json.

{ 
   "jest.pathToJest": "node_modules/.bin/jest --no-coverage --reporters=default"
}

I'll just leave this here for reference. :)

Stopping point

Jest-ratchet should have an option for where it will stop updating the threshold. Project could potentially have an acceptable threshold of 80 and whenever it reaches that point then ratchet will no longer change the threshold.

Disable ratchet by argument

For example, by default jest-ratchet would ratchet results, but if I were to run jest --disable-ratchet it wouldn't ratchet the results and the results would remain the same.

inplace is undefined

I just installed jest-ratchet and I'm getting the following error.

Error: An error occurred while adding the reporter at path "/code/omega/node_modules/jest-ratchet/index.js"._inplace is not defined
    at reporters.forEach (/code/omega/node_modules/jest/node_modules/jest-cli/build/TestScheduler.js:510:15)
    at Array.forEach (<anonymous>)
    at TestScheduler._addCustomReporters (/code/omega/node_modules/jest/node_modules/jest-cli/build/TestScheduler.js:497:15)
    at TestScheduler._setupReporters (/code/omega/node_modules/jest/node_modules/jest-cli/build/TestScheduler.js:466:12)
    at new TestScheduler (/code/omega/node_modules/jest/node_modules/jest-cli/build/TestScheduler.js:193:10)
    at /code/omega/node_modules/jest/node_modules/jest-cli/build/runJest.js:452:27
    at Generator.next (<anonymous>)
    at step (/code/omega/node_modules/jest/node_modules/jest-cli/build/runJest.js:107:30)
    at /code/omega/node_modules/jest/node_modules/jest-cli/build/runJest.js:118:15

The source is this line in index.js.

var inplace = _inplace;

It seems to come down to the fact that json-in-place is external in the Rollup config. The change happened in this 19c6c95.

I can fix it by manually editing the index.js. There's another line further down where I had to do the same thing for yargs_parser.

var inplace = require('json-in-place');

This works, but manually editing a file in node_modules isn't a solution. I could send a PR with the updated .js file, but it's just going to get broken again the next time a build is run. I'm guessing something needs to be changed in the Rollup or TypeScript config.

In the meantime, this library seems to be working for others. Maybe I'm just doing something wrong?

Coverage does not update if initial coverageThreshold values are set to 0

To reproduce, use the following config:

“coverageThreshold”: {
  “global”: {
    “branches”: 0,
    “lines”: 0,
    “functions”: 0,
    “statements”: 0
  }
}
  1. Run jest test suite
  2. Check jest config

Expected result:
coverageThreshold values are ratcheted up to the actual coverage values

Actual result:
coverageThreshold values are unchanged

fs.watch Handler on Mac OS X Invoked Before Tests Complete

There's an issue when no coverage directory exists yet and a freshly cloned repository is executing its first test run. I've been observing that specifically on Mac OS X, the onSummaryReportComplete function is being invoked by the fs.watch handler for the coverage directory before Jest completes the test run. This piece of code in the onRunComplete function is creating an empty file, coverage-summary.json.

    if (!fs.existsSync(coverageSummaryPath)) {
        fs.closeSync(fs.openSync(coverageSummaryPath, 'w'));
    }

The watch handler is getting invoked as a result despite the fact that the "watch" is put in place after the file is created. This results in an SyntaxError: Unexpected end of JSON input error upon exiting the test run.

When I remove this piece of code, everything works as expected even when I completely remove the coverage directory prior to run tests.

Is it necessary to create this file?

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.