Skip to content

Orangebeard listener for the Javascript Jest unit test framework

License

Notifications You must be signed in to change notification settings

orangebeard-io/jest-listener

Repository files navigation

Orangebeard.io Jest Listener
Orangebeard.io Jest Listener

Orangebeard listener for the Javascript Jest unit test framework.

NPM Version Build Status License

Installation

Install the npm package

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

Configuration

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",
    ...
  },
...

Create a new file named orangebeard.json in the project root folder, next to package.json. Add the following entry:

{
  "endpoint": "https://company.orangebeard.app",
  "accessToken": "00000000-0000-0000-0000-000000000000",
  "project": "project_name",
  "testset": "testset_NAME_EXAMPLE",
  "description": "Your description",
  "attributes": [
    {
      "key": "YourKey",
      "value": "YourValue"
    },
    {
      "value": "YourValue"
    }
  ],
  "listenerMode": "DEFAULT",
  "restClientConfig": {
    "timeout": 0
  }
}

Environment properties

Properties can also be set in the build, by passing them as environment variables. It's important to mention that environment variables have precedence over the orangebeard.json definition.

$ export ORANGEBEARD_ENDPOINT=https://company.orangebeard.app
$ export ORANGEBEARD_ACCESSTOKEN=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
$ export ORANGEBEARD_PROJECT=piet_personal
$ export ORANGEBEARD_TESTSET=piet_TEST_EXAMPLE
$ export ORANGEBEARD_DESCRIPTION=My awesome testrun
$ export ORANGEBEARD_ATTRIBUTES=key:value; value;

Tips & tricks

We would advise you to always use the Jest describe method around a set of tests, even if it's just one test. In that way the listener creates a suite. If you still don't want to use the describe method then the default suite name is Suite plus your test name.