create-adapter
create-adapter copied to clipboard
add test:js script to test-and-realase workflow
In package.json the creator defines test:js / test:ts scripcts: https://github.com/ioBroker/create-adapter/blob/master/templates/package.json.ts#L160 https://github.com/ioBroker/create-adapter/blob/master/templates/package.json.ts#L165
those will run **.test.js / **.test.ts files which can be used to define unit tests of single iobroker independent functions (or even iobroker dependent, if some mocking is done).
I think those tests should be added to the default github test-and-relaese workflow.
we could replace test:package against npm run test which includes test:js / test:ts and test:package
also unit tests should be removed: https://github.com/ioBroker/testing/pull/364
To me it also seems wrong that not all unit tests are executed with npm test
:
https://github.com/ioBroker/ioBroker.example/blob/19999a670c9b73a2436c2397467c2c7e54557437/JavaScript/package.json#L47-L51
(yes, I would exclude test:integration
, but all others should run and the workflow should also simply run nmp test
)
I remember now. The intention behind npm test
not including the integration tests was for it to be a fast check you can do often. Integration tests take a while with installing js-controller and the adapter etc., so the idea was that you run those on GitHub and locally only on demand.
It would probably make sense to include the test:unit
script, which basically only runs defineAdditionalTests
from test/unit.js
.