Test GPIO with Nodejs inside a Docker container
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Frieder Schlesier bcbf9e6f88 add jest mocks example for gpio+mqtt client 2 years ago
test initial commit 2 years ago
.gitignore initial commit 2 years ago
README.md add jest mocks example for gpio+mqtt client 2 years ago
action-on-gpio.js add jest mocks example for gpio+mqtt client 2 years ago
action-on-gpio.test.js add jest mocks example for gpio+mqtt client 2 years ago
app.js initial commit 2 years ago
gpio.js initial commit 2 years ago
package.json add jest mocks example for gpio+mqtt client 2 years ago

README.md

GPIO-mock test nodejs

test gpio in a container (without them being physically available)

idea/initial mock forked from: https://github.com/sitepoint-editors/TddWithGpio

Article: https://www.sitepoint.com/getting-started-with-the-raspberry-pi-gpio-pins-in-node-js/

run dev

docker run -it --rm -v $(pwd):/app -w /app node:lts bash

followed by

npm install
npm run test

Jest

TODO

idea: mock functions of onoff to test behaviour of functions which rely on GPIO being low/high

check this out: https://stackoverflow.com/questions/50066138/mock-fs-function-with-jest

is this going to be a problem? https://stackoverflow.com/questions/62568294/nodejs-fs-watch-inside-docker-container-detects-changes-twice