From b42f7c0b59674180d47f75a13ed0a79961b31381 Mon Sep 17 00:00:00 2001 From: Patrick Heneise Date: Wed, 4 Sep 2024 16:21:44 -0600 Subject: [PATCH] fix: tap --- package.json | 6 ++---- test/fetch-issues.test.js | 20 +++++++++----------- test/realworld.js | 8 -------- 3 files changed, 11 insertions(+), 23 deletions(-) delete mode 100644 test/realworld.js diff --git a/package.json b/package.json index 8b49004..39051d4 100644 --- a/package.json +++ b/package.json @@ -34,8 +34,7 @@ "release": "run-s lint test build", "lint": "eslint .", "license-checker": "license-checker --production --onlyAllow=\"MIT;ISC;BSD-3-Clause;BSD-2-Clause;Apache-2.0\"", - "test": "TZ=UTC tap --node-arg=--experimental-json-modules --test-env=GITHUB_REPOSITORY=gitevents/ics-test test/*.test.js", - "test:report": "tap --test-env=GITHUB_REPOSITORY=gitevents/ics-test test/*.test.js --cov", + "test": "TZ=UTC GITHUB_REPOSITORY=gitevents/ics-test node --test", "postinstall": "husky install", "prepublishOnly": "pinst --disable", "postpublish": "pinst --enable" @@ -77,8 +76,7 @@ "license-checker": "^25.0.1", "npm-run-all": "^4.1.5", "pinst": "^3.0.0", - "prettier": "^2.8.8", - "tap": "^18.8.0" + "prettier": "^2.8.8" }, "release": { "branches": [ diff --git a/test/fetch-issues.test.js b/test/fetch-issues.test.js index 407642e..4a01d20 100644 --- a/test/fetch-issues.test.js +++ b/test/fetch-issues.test.js @@ -1,7 +1,6 @@ 'use strict' - -import t from 'tap' -const test = t.test +import { test } from 'node:test' +import assert from 'node:assert' import { fetchIssues as fn } from '../src/fetch-issues.js' import ics from 'ics' @@ -57,7 +56,7 @@ const response = { } } -test('fetchIssues() returns parsed issues/events', async (t) => { +test('fetchIssues() returns parsed issues/events', async () => { const octokit = { graphql: function () { return response @@ -65,17 +64,16 @@ test('fetchIssues() returns parsed issues/events', async (t) => { } const actual = await fn(octokit) - t.ok(actual) + console.log(actual) + assert.ok(actual) const { error, value } = ics.createEvents(actual) if (error) { - console.error(error) - t.fail(error) + assert.fail(error) } - t.ok(value) + assert.ok(value) const lines = value.split(/\n/g) - t.match(actual[0].start, [2022, 12, 11, 14, 0]) - t.equal(lines[10].replace(/[\n\r]/g, ''), 'DTSTART:20221211T140000Z') - t.end() + assert.deepEqual(actual[0].start, [2022, 12, 11, 14, 0]) + assert.equal(lines[10].replace(/[\n\r]/g, ''), 'DTSTART:20221211T140000Z') }) diff --git a/test/realworld.js b/test/realworld.js deleted file mode 100644 index 212572d..0000000 --- a/test/realworld.js +++ /dev/null @@ -1,8 +0,0 @@ -import github from '@actions/github' -import { fetchIssues, fetchIssues as fn } from '../src/fetch-issues.js' - -const octokit = github.getOctokit(process.env.GITHUB_TOKEN) -const locationsFile = '' -const timeZone = 'Europe/Athens' -const events = await fetchIssues(octokit, locationsFile, timeZone) -console.log(JSON.stringify(events, null, 2))