This code demonstrates how to test a hyperapp project. Originally adapted from Mini Todo App. This is the code I worked on while live streaming, which you can watch here.
Clone the repo and use npm or yarn to install dependencies.
git clone https://github.com/LearnHyperapp/hyperapp-cypress-demo cd hyperapp-demo npm i
There are two scripts provided in package.json: start, and test.
npm start
will start the app on localhost:8080.
This needs to be running for Cypress to use it.
yarn test
will start the cypress application.
This will open a window so you can control which spec files are being ran.
When you run a spec file test, it will load a new controlled instance of Chrome.
From there, you will have an interface to see the results from tests, as well as an iframe of your app.
Tests are using start-server-and-test utility to start webpack dev server, run Cypress then shutdown the server.
To run tests in the interactive mode a single command starts the server and opens Cypress GUI
npm test
To run tests on CI in non-interactive mode use the following command.
npm run ci
These tests assume the server is running and the page locahost:8080
has the application page
These tests exercise individual view functions like TodoItem
by mounting it as a "mini web app" and then using Cypress to interact with them
These tests do not require DOM, but Cypress can run them anyway