Skip to content

A collection of boilerplate code for evaluating JavaScript testing frameworks and utilities

License

Notifications You must be signed in to change notification settings

jhildenbiddle/ci-test

Repository files navigation

ci-test

Build Status Codecov Codacy grade License: MIT

Sample code used for evaluating JavaScript testing frameworks:

Goals

  1. A consistent baseline configuration for each framework:

    • A modern JavaScript environment (ES6+ via Babel)
    • Local browser testing
    • Remote browser testing (SauceLabs)
    • Test fixtures (HTML, JSON, etc.)
    • Code coverage (Istanbul)
    • Code linting (ESLint)
  2. Integration with common test-related services:

    • Continuous Integration using Travis CI
    • Code coverage history and statistics using Codecov
    • Code quality history and statistics using Codacy

Quickstart

# Clone repo
git clone https://github.com/jhildenbiddle/ci-test.git

# Change to cloned repo directory
cd ci-test

# Install dependencies
npm install

# Run local tests
npm run test:cafe
npm run test:jest
npm run test:karma
npm run test:karma-debug

# Run remote tests (see "Notes" below)
npm run test:cafe-remote
npm run test:karma-remote

Notes

  1. Node 8 (or 7.6 + polyfill) required

    The sample code uses JavaScript's new async / await feature which requires Node 7.6 or above. The code also makes use of the util.promisify() utility function introduced in Node 8.x, but a polyfill is available for older versions.

  2. Install Chrome 59+ for "headless" browser testing

    Local tests are configured to use Chrome in "headless" mode by default. This requires Chrome 59 or above. If you do not have Chrome 59 (or above) installed or prefer to test with different browers, the settings for each test framework will need to be updated:

    • Jest: No browers to specify (test are executed using jsdom)
    • Karma: edit karma.conf.js and install the appropriate karma launchers
    • TestCafé: edit package.json and specify browsers via command line args
  3. Set SauceLabs username and access key for remote testing

    These can be set as environment variables (see SauceLabs wiki for details) or in saucelabs.config.js.

About

A collection of boilerplate code for evaluating JavaScript testing frameworks and utilities

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published