Skip to main content

Jest

Installation

Install the npm package

npm install --save-dev @orangebeard-io/jest-listener

The source code can be found on GitHub: Jest Listener

Configuration

Create a new file named orangebeard.json in the project's working folder or above:

{
"endpoint": "https://app.orangebeard.io/{ORGANIZATION}",
"token": "{ACCESS_TOKEN}",
"project": "{ORANGEBEARD_PROJECT}",
"testset": "Jest Test set",
"description": "Jest run",
"attributes": [
{
"key": "Tool",
"value": "Jest"
}
],
"referenceUrl": "https://docs.orangebeard.io/"
}

It's good practice to omit the token from the json file and get it from your env:

Windows cmd:

set orangebeard_token=[LISTENER TOKEN]

Linux/Mac:

export orangebeard_token=[LISTENER TOKEN]

In your jest config section of package.json, add the following entry:

{
"jest": {
...
"reporters": ["default","@orangebeard-io/jest-listener"],
...
}
}

For projects with Create-React-App the above Jest config doesn't work. You should edit the test command in the package.json like this:

...
"scripts": {
...
"test": "react-scripts test --reporters=default --reporters=@orangebeard-io/jest-listener",
...
},
...

Running Tests

Run your tests as usual!

Alternatively, configure Orangebeard variables as ENV (without or on top of orangebeard.json):

 ORANGEBEARD_ENDPOINT=https://company.orangebeard.app
ORANGEBEARD_TOKEN=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
ORANGEBEARD_PROJECT="my project"
ORANGEBEARD_TESTSET="my test set"
ORANGEBEARD_DESCRIPTION="My awesome testrun"
ORANGEBEARD_ATTRIBUTES="key:value; value;"