All Projects β†’ ocavue β†’ jest-puppeteer-istanbul

ocavue / jest-puppeteer-istanbul

Licence: MIT license
Collect code coverage information from end-to-end jest puppeteer tests

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to jest-puppeteer-istanbul

Tib
Easy e2e browser testing in Node
Stars: ✭ 64 (+146.15%)
Mutual labels:  e2e, puppeteer
Javascript Testing Best Practices
πŸ“—πŸŒ 🚒 Comprehensive and exhaustive JavaScript & Node.js testing best practices (August 2021)
Stars: ✭ 13,976 (+53653.85%)
Mutual labels:  integration-testing, e2e
Dappeteer
πŸŒπŸΌβ€E2E testing for dApps using Puppeteer + MetaMask
Stars: ✭ 117 (+350%)
Mutual labels:  e2e, puppeteer
Recorder
A browser extension that generates Cypress, Playwright and Puppeteer test scripts from your interactions πŸ–± ⌨
Stars: ✭ 277 (+965.38%)
Mutual labels:  e2e, puppeteer
rollup-plugin-istanbul
Seamless integration between Rollup and Istanbul
Stars: ✭ 39 (+50%)
Mutual labels:  coverage, istanbul
Pending Xhr Puppeteer
Small tool to wait that all xhr are finished in puppeteer
Stars: ✭ 227 (+773.08%)
Mutual labels:  e2e, puppeteer
Jest Puppeteer
Run your tests using Jest & Puppeteer πŸŽͺ✨
Stars: ✭ 3,267 (+12465.38%)
Mutual labels:  integration-testing, puppeteer
angular-cli-skeleton
angular-cli skeleton to quickly start a new project with advanced features and best practices. All features are described in README.md.
Stars: ✭ 32 (+23.08%)
Mutual labels:  coverage, e2e
unitest
🌎 Seamless node and browser unit testing with code coverage
Stars: ✭ 28 (+7.69%)
Mutual labels:  coverage, istanbul
istanbul-badges-readme
Creates and updates README testing coverage badges with your json-summary
Stars: ✭ 77 (+196.15%)
Mutual labels:  coverage, istanbul
playwright-demos
playwright for scrapping and UI testing / automate testing workflows
Stars: ✭ 65 (+150%)
Mutual labels:  e2e, puppeteer
Mochify.js
β˜•οΈ TDD with Browserify, Mocha, Headless Chrome and WebDriver
Stars: ✭ 338 (+1200%)
Mutual labels:  coverage, puppeteer
jest-badges-readme
Creates a group of coverage badges from Jest into your README
Stars: ✭ 30 (+15.38%)
Mutual labels:  coverage, istanbul
pysys-test
PySys System Test Framework
Stars: ✭ 14 (-46.15%)
Mutual labels:  integration-testing
FaceAvataaars
Puppeteer Avataaars with your iPhone X (and also test cartoons using BlendShapeRecorder data)
Stars: ✭ 19 (-26.92%)
Mutual labels:  puppeteer
puppeteer-botcheck
πŸ•΅β€β™‚ Bot detection tests for Puppeteer. Hide and seek!
Stars: ✭ 42 (+61.54%)
Mutual labels:  puppeteer
LInkedIn-Reverese-Lookup
πŸ”ŽSearch LinkedIn profile by email addressπŸ“§
Stars: ✭ 20 (-23.08%)
Mutual labels:  puppeteer
browser-automation-api
Browser automation API for repetitive web-based tasks, with a friendly user interface. You can use it to scrape content or do many other things like capture a screenshot, generate pdf, extract content or execute custom Puppeteer, Playwright functions.
Stars: ✭ 24 (-7.69%)
Mutual labels:  puppeteer
percy-puppeteer
Visual testing with Puppeteer and Percy
Stars: ✭ 47 (+80.77%)
Mutual labels:  puppeteer
simple-headless-browser-serverless
Simple example of how to use Chrome as headless browser on AWS lambda
Stars: ✭ 16 (-38.46%)
Mutual labels:  puppeteer

jest-puppeteer-istanbul

Using Playwright? Check https://github.com/ccpu/jest-playwright-istanbul, which is a fork of this project.

npm version Build Status

Install

yarn add -D jest-puppeteer-istanbul
// or
npm install -D jest-puppeteer-istanbul

Configure

[1/4]

Make sure that you have Jest and Babel installed and configured.

[2/4]

Install babel-plugin-istanbul and add it to your Babel config.

You should ONLY use this plugin when you are in development mode. This plugin will add a lot of code for keeping track of the coverage statements. You definitely won't want them in your final production code.

Babel configuration examples:

// .babelrc.js

const plugins = [ /* Your babel plugins */ ]
if (process.env.NODE_ENV === "development") {
  plugins.push("istanbul")
}
module.exports = {
  plugins: plugins
}
// babel.config.json

{
  "plugins": [
    // Your babel plugins
  ],
  "env": {
    "development": {
      "plugins": [
         "istanbul"
      ]
    }
  }
}

[3/4]

Update your Jest configuration:

  • Add json to coverageReporters. Since the defualt value of coverageReporters has json inclued, you don't need to change coverageReporters if you havn't specify it.
  • Add jest-puppeteer-istanbul/lib/setup to setupFilesAfterEnv.
  • Add jest-puppeteer-istanbul/lib/reporter to reporters.

Notice:

If custom reporters are specified, the default Jest reporters will be overridden. To keep default reporters, default can be passed as a module name.

A Jest configuration example:

{
  coverageReporters: ["json", "text", "lcov"],
  setupFilesAfterEnv: ["jest-puppeteer-istanbul/lib/setup"],
  reporters: ["default", "jest-puppeteer-istanbul/lib/reporter"],
  collectCoverage: true,
}

[4/4]

jest-puppeteer-istanbul need to access puppeteer page from global variable page to get coverage information. If you use jest-puppeteer, jest-puppeteer will do it for you and you can skip this step. Otherwise you need to do it yourself, like below:

beforeAll(async () => {
    const browser = await puppeteer.launch()
    const page = await browser.newPage()
    global.page = page
})
describe("E2E Tests", () => {
    test(async () => { /* Your test code */ })
})

Examples

Check this link for complete examples.

Troubleshooting

If you can't get the code coverage correctly when using the Jest from IntelliJ IDEA or WebStorm, that's because the IDE ignores jest-puppeteer-istanbul/lib/reporter in the jest.config.js in favour of its own Jest reporter. You can add --reporters jest-puppeteer-istanbul/lib/reporter in your IDE's Jest configuration like below to fix this.

IDEA config

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].