Skip to content

Commit

Permalink
Migrate test suite from Jasmine to AVA (#118)
Browse files Browse the repository at this point in the history
* Migrate test suite from Jasmine to AVA

* Update ESLint config

* Update CI workflow, add coverage collection step

* Add coverage badge

* Add clean and prebuild tasks

* Configure c8 reporters

* Test against src file (better line numbering)
  • Loading branch information
jgarber623 authored Sep 29, 2023
1 parent 28fc615 commit e52c97d
Show file tree
Hide file tree
Showing 10 changed files with 2,120 additions and 1,244 deletions.
7 changes: 7 additions & 0 deletions .c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"reporter": [
"html",
"lcovonly",
"text"
]
}
11 changes: 5 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@ jobs:
test:
name: Test
needs: lint
runs-on: macos-latest
strategy:
matrix:
browser: ["headlessChrome", "headlessFirefox", "MicrosoftEdge", "safari"]
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: npm
- run: npm ci
- run: npm test -- --browser=${{ matrix.browser }}
- run: npm test
- uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/coverage/
/dist/
/node_modules/
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[![Downloads](https://img.shields.io/npm/dt/@jgarber/templatetemplate.svg?logo=npm&style=for-the-badge)](https://www.npmjs.com/package/@jgarber/templatetemplate)
[![Build](https://img.shields.io/github/actions/workflow/status/jgarber623/TemplateTemplate/ci.yml?branch=main&logo=github&style=for-the-badge)](https://github.com/jgarber623/TemplateTemplate/actions/workflows/ci.yml)
[![Maintainability](https://img.shields.io/codeclimate/maintainability/jgarber623/TemplateTemplate.svg?logo=code-climate&style=for-the-badge)](https://codeclimate.com/github/jgarber623/TemplateTemplate)
[![Coverage](https://img.shields.io/codeclimate/c/jgarber623/TemplateTemplate.svg?logo=code-climate&style=for-the-badge)](https://codeclimate.com/github/jgarber623/TemplateTemplate/code)

### Key Features

Expand Down
17 changes: 12 additions & 5 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const config = require('@jgarber/eslint-config');
const globals = require('globals');

const pluginAva = require('eslint-plugin-ava');

module.exports = [
...config,
{
Expand All @@ -9,16 +11,21 @@ module.exports = [
{
files: ['src/**/*.?(m)js'],
languageOptions: {
globals: globals.browser
globals: {
...globals.browser
}
}
},
{
files: ['spec/**/*[sS]pec.?(m)js'],
files: ['test/**/*.?(m)js'],
languageOptions: {
globals: {
...globals.browser,
...globals.jasmine
...globals.browser
}
}
},
plugins: {
ava: pluginAva
},
rules: pluginAva.configs.recommended.rules
}
];
Loading

0 comments on commit e52c97d

Please sign in to comment.