mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
79 lines
2.5 KiB
YAML
79 lines
2.5 KiB
YAML
metadata:
|
|
name: karmaExecuteTests
|
|
description: Executes the Karma test runner
|
|
longDescription: |
|
|
In this step the ([Karma test runner](http://karma-runner.github.io)) is executed.
|
|
|
|
The step is using the `seleniumExecuteTest` step to spin up two containers in a Docker network:
|
|
|
|
* a Selenium/Chrome container (`selenium/standalone-chrome`)
|
|
* a NodeJS container (`node:lts-stretch`)
|
|
|
|
In the Docker network, the containers can be referenced by the values provided in `dockerName` and `sidecarName`, the default values are `karma` and `selenium`. These values must be used in the `hostname` properties of the test configuration ([Karma](https://karma-runner.github.io/1.0/config/configuration-file.html) and [WebDriver](https://github.com/karma-runner/karma-webdriver-launcher#usage)).
|
|
|
|
!!! note
|
|
In a Kubernetes environment, the containers both need to be referenced with `localhost`.
|
|
spec:
|
|
inputs:
|
|
resources:
|
|
- name: buildDescriptor
|
|
type: stash
|
|
- name: tests
|
|
type: stash
|
|
params:
|
|
- name: installCommand
|
|
type: string
|
|
description: The command that is executed to install the test tool.
|
|
default: npm install --quiet
|
|
scope:
|
|
- GENERAL
|
|
- PARAMETERS
|
|
- STAGES
|
|
- STEPS
|
|
mandatory: true
|
|
- name: modulePath
|
|
type: string
|
|
description: Define the path of the module to execute tests on.
|
|
default: "."
|
|
scope:
|
|
- PARAMETERS
|
|
- STAGES
|
|
- STEPS
|
|
mandatory: true
|
|
- name: runCommand
|
|
type: string
|
|
description: The command that is executed to start the tests.
|
|
default: npm run karma
|
|
scope:
|
|
- GENERAL
|
|
- PARAMETERS
|
|
- STAGES
|
|
- STEPS
|
|
mandatory: true
|
|
#outputs:
|
|
containers:
|
|
- name: karma
|
|
image: node:lts-stretch
|
|
env:
|
|
- name: no_proxy
|
|
value: localhost,selenium,$no_proxy
|
|
- name: NO_PROXY
|
|
value: localhost,selenium,$NO_PROXY
|
|
workingDir: /home/node
|
|
volumeMounts:
|
|
- mountPath: /dev/shm
|
|
name: dev-shm
|
|
sidecars:
|
|
- image: selenium/standalone-chrome
|
|
name: selenium
|
|
securityContext:
|
|
privileged: true
|
|
volumeMounts:
|
|
- mountPath: /dev/shm
|
|
name: dev-shm
|
|
env:
|
|
- name: "NO_PROXY"
|
|
value: "localhost,karma,$NO_PROXY"
|
|
- name: "no_proxy"
|
|
value: "localhost,selenium,$no_proxy"
|