I want to try CI/CD. So I am working on a simple project. I wanted to run the test file. But I get the error "mocha: command not found". There is no problem when I try it in my own terminal. How can I solve this?
Thanks.
"mocha: command not found" means you have to install mocha in your gitlab runner environment.
test:
stage: test
script:
- npm install --global mocha
- mocha test
Related
I know my question is similar to this one, but hope someone can help me to execute Playwright tests in the Gitlab pipeline.
My .gitlab-ci.yaml insludes next lines:
image: node:16.13.0
...
test e2e:
stage: test
script:
- npx playwright install
- npm run test-e2e
Can I somehow set a proper docker image or OS that is supported..?
Was described in the official docs https://playwright.dev/docs/ci#gitlab-ci
You can set image per job like in my case:
test e2e:
stage: test
**image: mcr.microsoft.com/playwright:v1.16.3-focal**
script:
- npx playwright install
- npm run test-e2e
When I try to use cypress open or cypress run, I get the following error:
✖ Verifying Cypress can run /*/*/.cache/Cypress/3.1.5/Cypress
→ Cypress Version: 3.1.5
Cypress failed to start.
This is usually caused by a missing library or dependency.
The error below should indicate which dependency is missing.
https://on.cypress.io/required-dependencies
If you are using Docker, we provide containers with all required dependencies installed.
----------
Command failed: /*/*/.cache/Cypress/3.1.5/Cypress/Cypress --smoke-test --ping=984
----------
Platform: darwin (17.6.0)
Cypress Version: 3.1.5
There are no dependencies listed in the error, and I'm not using docker. What should I try?
Simply try ./node_modules/.bin/cypress install if you're using Cypress for the first time.
One thing that worked for me was unsetting the NODE_OPTIONS environment variable:
on MacOS
unset NODE_OPTIONS
cypress open
on Windows
set NODE_OPTIONS=
cypress open
if that fails, try the following as suggested by a user on Github:
on MacOS:
clear /Users/[username]/Library/Caches/Cypress
run npm i cypress -g
run cypress open
close terminal
return back to your node.js project and run the tests
on Windows:
clear C:\Users[username]\AppData\Local\Cypress\Cache)
start a command prompt as administrator
run npm i cypress -g
run cypress open
close command prompt
return back to your node.js project and run the tests
I've been trying yo integrate travis for CI in my free-source project.
When I push to my repository, all looks ok , but after execute karma start --single-run, the console of the travis don't stop to execute the karma start task.
How to fix this?
.travis.yml
language: node_js
sudo: false
node_js:
- 0.10
script: karma start -–single-run
before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
before_script:
- npm install -g bower
- npm install
- bower install
Travis Console
Updated Question :
Why in the travis process when i use in the console karma start --single-run the option no overwrite the option singleRun: false in the karma.conf.js? In my local environment this works fine.
Finally I solved, the problem was in my karma.conf.js
singleRun: true,
I change this option from false to true. Frequently when i develop, use singleRun option in my karma configuration file to false for use auto watch option.
The weird thing it's that in my local machine when i run karma with the option explicity in the command line (karma start --single-run), the option in the karma.conf.js is overwritten, but in travis this it's not posible.
I'm trying to use CircleCI for one of my node.js application. I'm trying to learn the way circleci works.
My app and test cases are running fine locally. I'm using jasmine-node for test.
But when I'm trying to build my app on circleci I'm getting below error. Below is a screenshot from circleci:
Please let me know anyone has any idea on this!
CircleCi is saying that jasmine-node isn't installed.
Add the following code to your circle.yml file.
dependencies:
post:
- sudo npm install jasmine-node -g
I'm using Testacular which is a Node.js test runner for Angular/Jasmine. I can run it fine from the command line, but every time I try to run it from Jenkins build steps, it bombs out with all sorts of errors regarding environment variables. I tried the Nodejs plugin for Jenkins, but that's just to run node code snippets. Anyone know of a way to have node apps (eg. Testacular) running test under Jenkins?
You will need to:
have "testacular" as a dependency in your package.json file.
install your dependencies with npm install (do this as a build step)
call it as ./node_modules/.bin/testacular start --single-run
Assuming you have configured testacular to use PhantomJs browsers = ['PhantomJS'];, you just need to have the phantomjs binary in your path or tell testacular where it is located with an environment variable set in your shell:
export PHANTOMJS_BIN=$HOME/local/bin/phantomjs
good news!
" I tried the Nodejs plugin for Jenkins, but that's just to run node code snippets. "
nope!
install the nodejs plugin see instructions here -> NodeJS jenkins plugin broken?
then tick "Provide Node/npm bin folder to PATH" and when running a "execute shell" build task, you can use nodejs, here's a example using grui
npm update
grunt
grunt --force reporting