Seamlessly use the power of Karate from Node / JS projects.
Given this script test.js
:
#! /usr/bin/env node
const karate = require('@karatelabs/karate');
karate.exec();
And in package.json
(use the latest version from npm):
{
"scripts": {
"test": "node test.js"
},
"devDependencies": {
"@karatelabs/karate": "^0.2.1"
}
}
When you run npm install
, jbang and other Karate dependencies needed will be installed via jbang-npm
.
And to run a single test:
npm run test karate/httpbin.feature
Or to run all tests in a folder:
npm run test karate