From 2ede42d486442af84c4f349deaf2f8996223a52d Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Wed, 27 Jan 2021 12:48:51 +0200 Subject: [PATCH] Add testing in browsers (#21) * 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 --- .airtap.yml | 7 +++++++ .dependabot/config.yml | 3 --- .github/workflows/ci.yml | 9 +++++++++ .gitignore | 2 +- package.json | 9 +++++++-- test.js | 2 +- 6 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 .airtap.yml diff --git a/.airtap.yml b/.airtap.yml new file mode 100644 index 0000000..f5fc1fe --- /dev/null +++ b/.airtap.yml @@ -0,0 +1,7 @@ +providers: + - airtap-playwright + +browsers: + - name: chromium + supports: + headless: true diff --git a/.dependabot/config.yml b/.dependabot/config.yml index 778e799..cae63e3 100644 --- a/.dependabot/config.yml +++ b/.dependabot/config.yml @@ -3,6 +3,3 @@ update_configs: - package_manager: "javascript" directory: "/" update_schedule: "daily" - ignored_updates: - - match: - dependency_name: "tap" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 116c663..321bba8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/.gitignore b/.gitignore index 8f679c9..9ff9863 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ **/node_modules **/package-lock.json -coverage.* +/.nyc_output **/.DS_Store **/._* diff --git a/package.json b/package.json index 91a60d2..79f77a8 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" } } diff --git a/test.js b/test.js index 525b870..1d04fee 100644 --- a/test.js +++ b/test.js @@ -1,6 +1,6 @@ 'use strict' -const test = require('tap').test +const test = require('tape').test const j = require('./index') test('parse', t => {