This repo contains tests for Jest application with Testomat.io plugins
This is a playground for your first steps in testing, so instead of installing it from NPM it is recommended to clone it from repo instead.
- Clone this repository
git clone git@github.com:testomatio/examples.git && cd examples/jest
- Install dependencies via npm:
npm i
This will install jest & Testomat.io reporter
- Create empty project in Testomat.io
- Obtain API key from Testomat.io
- Run
npx check-teststo upload tests data into testomat.io. Pass api key asTESTOMATIOenvironment variable:
TESTOMATIO={apiKey} npx check-tests jest "**/*{.,_}test.js"
Environment variables It is recommended to store Testomatio API Key as environment variable and never save it in the source code. Set them directly when running tests or use dotenv package to save environment variable in a file and load them for tests.
Get API key from a project in Testomat.io and set it as environment variable TESTOMATIO:
TESTOMATIO={apiKey} npx jest run -t "Mark as completed"
Testomatio reporter is a plugin and should be enabled in jest.conf.js:
Do not hard code apiKey and always use it as environment variable.
module.exports = {
testEnvironment: "node",
reporters: ['default', ['@testomatio/reporter/lib/adapter/jest.js', { apiKey: process.env.TESTOMATIO }]],
};