Skip to content

Commit

Permalink
Added a github workflow that runs the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NikkelM committed Jun 3, 2023
1 parent 59fcb67 commit 9fd940a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run Tests

# These rules will run the workflow when a push or PR is made to/against the main branch
on:
push:
branches:
- main
pull_request:
branches:
- main

# This concurrency mode will cancel in-progress workflows if a new commit is pushed
concurrency:
group: ${{ github.head_ref || github.ref_name }}
cancel-in-progress: true

jobs:
Test:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v3

- name: Set up node
uses: actions/setup-node@v3

- name: Install dependencies
run: npm install

- name: Run tests
run: npm test

# If you want to use coveralls to report the coverage produced by c8, uncomment this step
# - name: Coveralls
# uses: coverallsapp/github-action@v2
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ The boilerplate comes with a test suite using [mocha](https://mochajs.org/), and
Some basic tests that test the interaction with the chrome storage API have already been implemented to get you started. You can run the test suite using `npm test`.
Testing the chrome API is especially interesting, as it is not available in the test environment. To get around this, you can use the `sinon-chrome` package to mock the API, some examples of this have been pre-implemented and can be found in `test/setup.js`. This setup file will run before the other tests.

The `test.yml` file in `.github/workflows` contains a GitHub Actions workflow that will run the test suite on every PR against the `main` branch and every push to the `main` branch.

## More resources

- [Welcome to Manifest V3](https://developer.chrome.com/docs/extensions/mv3/intro/)
Expand Down

0 comments on commit 9fd940a

Please sign in to comment.