Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

wildpeaks/2020-example-tests-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JS Tests: Node

Option 2: run entirely in Node.

Tests run faster and use less memory when they don't need a browser.

This works best for testing code that isn't tied to the DOM (such as parsing text or transforming JSON scenegraphs).

Unlike Option 1, this doesn't require a human to run the test, so other actions could be chained (such as releasing a new version of a library, or sending an alert that the build is broken).

The other options:


Run the tests locally

First, install Node.

Then install the project dependencies:

npm install

Then run the test script (it runs the command defined in package.json):

npm test

Screenshot of Powershell


Run the tests on code push

The file /.github/worksflows/tests.yml signals Github to re-run the tests when new code is available, using Github Actions.

The results are displayed in the tab Actions of the repository. Depending on your settings, you would also receive a notification with a direct link to the results after a test has run.

Screenshot of Github Actions


VSCode

The .vscode folder is optional: it merely defines the path to the tests and recommends a few matching extensions.

This way, you could run specific tests on their own in the debugger, using Tests Explorer, and get direct feedback in the editor.

Screenshot of VSCode with Tests Explorer


About

[ARCHIVED] Example showing test running in Node

Resources

License

Stars

Watchers

Forks