Skip to content

Commit

Permalink
Add testing in browsers (#21)
Browse files Browse the repository at this point in the history
* Switch testing to tape

This is primarily to support a future addition of airtap which relies on tape.

* Run tests in a browser

* Run browser tests in CI

* Add test coverage
  • Loading branch information
denis-sokolov authored Jan 27, 2021
1 parent d124635 commit 2ede42d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .airtap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
providers:
- airtap-playwright

browsers:
- name: chromium
supports:
headless: true
3 changes: 0 additions & 3 deletions .dependabot/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ update_configs:
- package_manager: "javascript"
directory: "/"
update_schedule: "daily"
ignored_updates:
- match:
dependency_name: "tap"
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: CI workflow
on: [push, pull_request]
jobs:
browsers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- name: Install Dependencies
run: npm install
- name: Test
run: npm run test-in-browsers
test:
runs-on: ubuntu-latest
strategy:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
**/node_modules
**/package-lock.json

coverage.*
/.nyc_output

**/.DS_Store
**/._*
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "index.js",
"scripts": {
"benchmark": "cd benchmarks && npm install && npm run all",
"test": "standard && tap test.js"
"test": "standard && nyc tape test.js",
"test-in-browsers": "airtap test.js"
},
"repository": {
"type": "git",
Expand All @@ -25,7 +26,11 @@
},
"homepage": "https://github.com/fastify/secure-json-parse#readme",
"devDependencies": {
"airtap": "^4.0.1",
"airtap-playwright": "^1.0.1",
"nyc": "^14.1.1",
"playwright": "^1.7.1",
"standard": "^16.0.0",
"tap": "^12.7.0"
"tape": "^5.1.1"
}
}
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const test = require('tap').test
const test = require('tape').test
const j = require('./index')

test('parse', t => {
Expand Down

0 comments on commit 2ede42d

Please sign in to comment.