🦑 Easy automatic (headless) browser testing with Jest's API, but powered by Karma & Webpack.
by developitLast 12 weeks · 0 commits
1 of 6 standards met
My attempt to include more Jest globals. Sharing to get early feedback though I need to take a break from this for now to focus on other things. fakeTimers.test.js has two tests failing right now because I think some tests are improperly leaking changed globals between tests. But I think this PR gets Jest's mocking function and fake timers API working!
Repository: developit/karmatic. Description: 🦑 Easy automatic (headless) browser testing with Jest's API, but powered by Karma & Webpack. Stars: 1166, Forks: 42. Primary language: JavaScript. Languages: JavaScript (100%). Homepage: https://npm.im/karmatic Topics: chrome-headless, jasmine, jest, karma, karma-plugin, karma-webpack, test-runner, testing. Latest release: 2.0.0 (5y ago). Open PRs: 5, open issues: 5. Last activity: 3y ago. Community health: 28%. Top contributors: developit, andrewiggins, marvinhagemeister, dennis-johnson-dev, eliperelman, Weetbix, suchipi, lucapette.
JavaScript
With the new E2E test suite, I noticed that coverage is not properly reported when the user provides a custom webpack.config.js. This PR fixes that by detecting if webpack loaders exist and if so, adding a new babel-loader with just the coverage plugin enabled. Our tests also now enforce that coverage is correctly reported for all tests.
I'm not using webpack, i am using rollup ```
Couple of decisions I made up I wanted to call out: 1. I decided to include and plugins as deps so our default rollup config is mildly useful. Was thinking for uses with where there isn't a for us to use. Would be curious to get other's thoughts here on what plugins we should include. 2. If a rollup config is present, then I just use that unmodified. I'm not sure if rollup provides an API to modify the config/options of plugin instances from a config object. I think this method (of just using the provided config unmodified) is fine though. I think the only thing lost right now is code coverage (though I guess I could just add another babel plugin instance with only the coverage plugin configured...) This is still a work in progress but thought I'd put an early draft out here to get some feedback. I also need to update the testing infra a bit so I can validate this implementation but that's gonna come in a different PR.