From 05c13ecd4089a74ffebe8ce357f1154755a412e5 Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Mon, 18 Jan 2021 12:00:00 +0000 Subject: [PATCH 1/4] Switch testing to tape This is primarily to support a future addition of airtap which relies on tape. --- .dependabot/config.yml | 3 --- package.json | 4 ++-- test.js | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) 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/package.json b/package.json index 9ee06fd..9b4066e 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "benchmark": "cd benchmarks && npm install && npm run all", - "test": "standard && tap test.js" + "test": "standard && tape test.js" }, "repository": { "type": "git", @@ -26,6 +26,6 @@ "homepage": "https://github.com/fastify/secure-json-parse#readme", "devDependencies": { "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 => { From 54c48e33f0fdb4bf559525ab2b1b4a3d54de50e3 Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Mon, 18 Jan 2021 12:00:00 +0000 Subject: [PATCH 2/4] Run tests in a browser --- .airtap.yml | 7 +++++++ package.json | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) 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/package.json b/package.json index 9b4066e..dfbbc96 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 && tape test.js" + "test": "standard && tape test.js", + "test-in-browsers": "airtap test.js" }, "repository": { "type": "git", @@ -25,6 +26,9 @@ }, "homepage": "https://github.com/fastify/secure-json-parse#readme", "devDependencies": { + "airtap": "^4.0.1", + "airtap-playwright": "^1.0.1", + "playwright": "^1.7.1", "standard": "^16.0.0", "tape": "^5.1.1" } From 3179e6a9024ef4e55a0bbc8a9a9369bcaff83247 Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Tue, 19 Jan 2021 12:00:00 +0000 Subject: [PATCH 3/4] Run browser tests in CI --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) 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: From 192fe2427a1a253612e164c118b51de40e9238e3 Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Thu, 21 Jan 2021 12:00:00 +0000 Subject: [PATCH 4/4] Add test coverage --- .gitignore | 2 +- package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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 dfbbc96..76ed43a 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "benchmark": "cd benchmarks && npm install && npm run all", - "test": "standard && tape test.js", + "test": "standard && nyc tape test.js", "test-in-browsers": "airtap test.js" }, "repository": { @@ -28,6 +28,7 @@ "devDependencies": { "airtap": "^4.0.1", "airtap-playwright": "^1.0.1", + "nyc": "^14.1.1", "playwright": "^1.7.1", "standard": "^16.0.0", "tape": "^5.1.1"