Closed MK-2001 closed 4 years ago
Do you have a link to such a broken testing?
Like that: https://travis-ci.com/github/MK-2001/ioBroker.go-echarger/builds/175656151 ? Line 1328
@AlCalzone Error: Cannot find module 'axios'
🤔
Why do you load axios in the integration test file and not use it? That is NOT part of the default testing. https://github.com/MK-2001/ioBroker.go-e/blob/decde81fc7a1b8a85f9bb7c95db886020d879844/test/integration.js
Also, your .travis.yml
is nonstandard. It should look like this:
os:
- linux
- osx
- windows
language: node_js
node_js:
- '10'
- '12'
- '14'
env:
- CXX=g++-6
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
before_install:
- 'if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then CC=gcc-6; fi'
- 'if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then CC=g++-6; fi'
before_script:
- export NPMVERSION=$(echo "$($(which npm) -v)"|cut -c1)
- 'if [[ $NPMVERSION == 5 ]]; then npm install -g npm; fi'
- npm -v
script:
- npm run test:package
- npm run test:unit
- export DEBUG=testing:*
- npm run test:integration
HI,
Sorry there has someone used the same name on npm, therefore I needed to rename my package.
What is nonstandard in my .travis.yml? if the settings are not given, travis is using the default.
I adapted now your changes on "os" and "script". but no change if I activate the line https://github.com/MK-2001/ioBroker.go-e/blob/3a29ac073fa4733677cd61efbb2dcb20f1eb75d9/test/integration.js#L5
Why do you load axios in the integration test file and not use it? That is NOT part of the default testing. https://github.com/MK-2001/ioBroker.go-e/blob/decde81fc7a1b8a85f9bb7c95db886020d879844/test/integration.js
I removed it now. This was a test to let the env install axios.
What is nonstandard in my .travis.yml?
It was not based on the one we have in the templates, which makes troubleshooting harder. Also, the default command is npm test
which just executes your own test files and the package file tests, but neither unit nor integration tests.
I removed it now. This was a test to let the env install axios.
Then you should also reactivate the last line which actually does the test. If your adapter requires axios during the runtime, it should be a dependency
, not a devDependency
, so it gets installed when installing the adapter.
If you want to write your own tests instead and they require axios, it should be fine as a devDependency. Just import it in your own test file, e.g. https://github.com/MK-2001/ioBroker.go-e/blob/master/main.test.js
You can run those with npm run test:js
.
🙈 OMG! Thanks. I was sure, that I added it as dependency! Sorry. My BUG!
And Thanks a lot! I added it and activated testing again.
Hello,
I am using the default test from https://github.com/ioBroker/create-adapter.
With it I get an erring during the test, that a required module from 7pm of my Adapter could not be found.
How I can add an additional module for your tests?
My Repo is there: https://github.com/MK-2001/ioBroker.go-e