@stepci/runner
v2.0.7
Published
Step CI Runner
Downloads
13,482
Readme
Step CI Runner
Step CI Test Runner
Installation
npm install @stepci/runner
Usage
Run workflow from file
import { runFromFile } from '@stepci/runner'
runFromFile('./examples/status.yml').then(console.log)
Run workflow from config
import { run } from '@stepci/runner'
// Example workflow
const workflow = {
version: "1.0",
name: "Status Test",
env: {
host: "example.com"
},
tests: {
example: {
steps: [{
name: "GET request",
http: {
url: "https://${{env.host}}",
method: "GET",
check: {
status: "/^20/"
}
}
}]
}
}
}
run(workflow).then(console.log)
Events
If you supply an EventEmitter
as argument, you can subscribe to following events:
step:http_request
, when a http request is madestep:http_response
, when a http response is receivedstep:grpc_request
, when a grpc request is madestep:grpc_response
, when a grpc is receivedstep:result
, when step finishesstep:error
, when step errorstest:result
, when test finishesworkflow:result
, when workflow finishesloadtest:result
, when loadtest finishes
Example: Events
import { run } from '@stepci/runner'
import { EventEmitter } from 'node:events'
// Example workflow
const workflow = {
version: "1.0",
name: "Status Test",
env: {
host: "example.com"
},
tests: {
example: {
steps: [{
name: "GET request",
http: {
url: "https://${{env.host}}",
method: "GET",
check: {
status: "/^20/"
}
}
}]
}
}
}
const ee = new EventEmitter()
ee.on('done', console.log)
run(workflow, { ee })