Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move test to node test framework #110

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

allevo
Copy link
Member

@allevo allevo commented Sep 26, 2024

Hi!
I moved the test suite from tap to node test framework.

Checklist

package.json Outdated Show resolved Hide resolved
test/test.js Show resolved Hide resolved
test/test.js Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@gurgunday gurgunday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +3 to 5
const t = require('node:test')
const assert = require('node:assert')
const test = t.test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit import test on same line

Suggested change
const t = require('node:test')
const assert = require('node:assert')
const test = t.test
const { test } = require('node:test')

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to this comment: #110 (comment)

Use test context assert ref

Example:

test('Test Name', t => {
  t.plan(1) // plan
  // stuff
    t.assert.strictEqual(value, expectedValue) // asset
})

Example with nested tests:

test('Test Name', async (t) => {
  t.plan(2)

  await t.test('Test Name', t => {
    t.plan(1) // plan
    // stuff
    t.assert.strictEqual(value, expectedValue) // assert
  })

  await t.test('Test Name', t => {
    t.plan(2) // plan
    // stuff
    t.assert.strictEqual(value, expectedValue) // assert
    t.assert.deepStrictEqual(objValue, expectedObjValue) // assert
  })
})

@@ -1,6 +1,7 @@
'use strict'

const t = require('tap')
const t = require('node:test')
const assert = require('node:assert')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove node:assert in favor of test context assert ref

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants