Skip to content

Jest plugin that communicates with node lights using jest hooks

Notifications You must be signed in to change notification settings

vehikl/jest-lights

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jest Lights

A jest reporter that turns on and off traffic lights based on test results

Install

npm install --save-dev @vehikl/jest-lights
# OR
yarn add --dev @vehikl/jest-lights

Configure Jest

You'll need to add this reporter to your jest configuration, which may be in package.json#jest, or more recent versions are in jest.config.js.

If you have your jest config in package.json:

{
  // ...
  "jest": {
    // ...
    "reporters": [
      "default",
      "...other-reporters?",
      "@vehikl/jest-lights"
    ]
  }
}

And jest.config.js:

module.exports = {
  reporters: [
    "default",
    "...other-reporters?",
    "@vehikl/jest-lights"
  ]
}

Run Tests

You'll need to set the LIGHTS_API_HOST environment variable. By default, it points to localhost:8080, but this will likely be wrong. If not configured, or configured incorrectly, you will see a warning message with appropriate instructions.

For best results, set the environment variable in your package.json#scripts#test script:

{
  "scripts": {
    // ...
    "test": "LIGHTS_API_HOST=192.168.0.xxx:8080 jest"
  }
}

If all goes to plan, the traffic lights will change as you run your tests.

About

Jest plugin that communicates with node lights using jest hooks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published