test(audit-core,predicates,otp,xo-server): move from tap to test

Support of Mocha syntax is much easier than in latest versions of tap
This commit is contained in:
Julien Fontanet 2024-02-01 15:43:06 +01:00
parent 2262ce8814
commit e7a97fd175
14 changed files with 29 additions and 26 deletions

View File

@ -1,5 +1,5 @@
import { strict as assert } from 'node:assert' import { strict as assert } from 'node:assert'
import { describe, it } from 'tap/mocha' import test from 'test'
import { import {
generateHotp, generateHotp,
@ -11,6 +11,8 @@ import {
verifyTotp, verifyTotp,
} from './index.mjs' } from './index.mjs'
const { describe, it } = test
describe('generateSecret', function () { describe('generateSecret', function () {
it('generates a string of 32 chars', async function () { it('generates a string of 32 chars', async function () {
const secret = generateSecret() const secret = generateSecret()

View File

@ -31,9 +31,9 @@
}, },
"scripts": { "scripts": {
"postversion": "npm publish --access public", "postversion": "npm publish --access public",
"test": "tap" "test": "node--test"
}, },
"devDependencies": { "devDependencies": {
"tap": "^16.3.0" "test": "^3.3.0"
} }
} }

View File

@ -1,7 +1,7 @@
'use strict' 'use strict'
const assert = require('assert/strict') const assert = require('assert/strict')
const { describe, it } = require('tap').mocha const { describe, it } = require('test')
const { every, not, some } = require('./') const { every, not, some } = require('./')

View File

@ -32,9 +32,9 @@
}, },
"scripts": { "scripts": {
"postversion": "npm publish --access public", "postversion": "npm publish --access public",
"test": "tap" "test": "node--test"
}, },
"devDependencies": { "devDependencies": {
"tap": "^16.0.1" "test": "^3.3.0"
} }
} }

View File

@ -1,7 +1,7 @@
'use strict' 'use strict'
const assert = require('assert/strict') const assert = require('assert/strict')
const { afterEach, describe, it } = require('tap').mocha const { afterEach, describe, it } = require('test')
const { AlteredRecordError, AuditCore, MissingRecordError, NULL_ID, Storage } = require('.') const { AlteredRecordError, AuditCore, MissingRecordError, NULL_ID, Storage } = require('.')

View File

@ -13,7 +13,7 @@
}, },
"scripts": { "scripts": {
"postversion": "npm publish --access public", "postversion": "npm publish --access public",
"test": "tap --lines 67 --functions 92 --branches 52 --statements 67" "test": "node--test"
}, },
"dependencies": { "dependencies": {
"@vates/decorate-with": "^2.1.0", "@vates/decorate-with": "^2.1.0",
@ -28,6 +28,6 @@
"url": "https://vates.fr" "url": "https://vates.fr"
}, },
"devDependencies": { "devDependencies": {
"tap": "^16.0.1" "test": "^3.3.0"
} }
} }

View File

@ -151,7 +151,7 @@
"babel-plugin-transform-dev": "^2.0.1", "babel-plugin-transform-dev": "^2.0.1",
"cross-env": "^7.0.2", "cross-env": "^7.0.2",
"index-modules": "^0.4.3", "index-modules": "^0.4.3",
"tap": "^16.0.1" "test": "^3.3.0"
}, },
"scripts": { "scripts": {
"_build": "index-modules --index-file index.mjs src/api src/xapi/mixins src/xo-mixins && babel --delete-dir-on-start --keep-file-extension --source-maps --out-dir=dist/ src/", "_build": "index-modules --index-file index.mjs src/api src/xapi/mixins src/xo-mixins && babel --delete-dir-on-start --keep-file-extension --source-maps --out-dir=dist/ src/",
@ -160,7 +160,7 @@
"prepublishOnly": "yarn run build", "prepublishOnly": "yarn run build",
"start": "node dist/cli.mjs", "start": "node dist/cli.mjs",
"pretest": "yarn run build", "pretest": "yarn run build",
"test": "tap 'dist/**/*.spec.mjs'" "test": "node--test dist"
}, },
"author": { "author": {
"name": "Vates SAS", "name": "Vates SAS",

View File

@ -1,9 +1,9 @@
import assert from 'assert/strict' import assert from 'assert/strict'
import tap from 'tap' import test from 'test'
import ensureArray from './_ensureArray.mjs' import ensureArray from './_ensureArray.mjs'
const { describe, it } = tap.mocha const { describe, it } = test
describe('ensureArray()', function () { describe('ensureArray()', function () {
it('wrap the value in an array', function () { it('wrap the value in an array', function () {

View File

@ -1,9 +1,10 @@
import tap from 'tap' import assert from 'node:assert'
import test from 'test'
import normalizeVmNetworks from './_normalizeVmNetworks.mjs' import normalizeVmNetworks from './_normalizeVmNetworks.mjs'
tap.test('normalizeVmNetworks', async t => { test('normalizeVmNetworks', async t => {
t.strictSame( assert.deepStrictEqual(
normalizeVmNetworks({ normalizeVmNetworks({
// legacy protocol // legacy protocol
'0/ip': '127.0.0.1 127.0.0.2', '0/ip': '127.0.0.1 127.0.0.2',

View File

@ -1,8 +1,8 @@
import assert from 'assert/strict' import assert from 'assert/strict'
import tap from 'tap' import test from 'test'
import { debounceWithKey, REMOVE_CACHE_ENTRY } from './_pDebounceWithKey.mjs' import { debounceWithKey, REMOVE_CACHE_ENTRY } from './_pDebounceWithKey.mjs'
const { describe, it } = tap.mocha const { describe, it } = test
describe('REMOVE_CACHE_ENTRY', () => { describe('REMOVE_CACHE_ENTRY', () => {
it('clears the cache', async () => { it('clears the cache', async () => {

View File

@ -1,10 +1,10 @@
import assert from 'assert/strict' import assert from 'assert/strict'
import forEach from 'lodash/forEach.js' import forEach from 'lodash/forEach.js'
import tap from 'tap' import test from 'test'
import { thunkToArray } from './utils.mjs' import { thunkToArray } from './utils.mjs'
import { crossProduct, mergeObjects } from './math.mjs' import { crossProduct, mergeObjects } from './math.mjs'
const { describe, it } = tap.mocha const { describe, it } = test
describe('mergeObjects', function () { describe('mergeObjects', function () {
forEach( forEach(

View File

@ -1,11 +1,11 @@
import assert from 'assert/strict' import assert from 'assert/strict'
import tap from 'tap' import test from 'test'
import { createReadStream, readFile } from 'fs' import { createReadStream, readFile } from 'fs'
import { fromCallback } from 'promise-toolbox' import { fromCallback } from 'promise-toolbox'
import streamToExistingBuffer from './stream-to-existing-buffer.mjs' import streamToExistingBuffer from './stream-to-existing-buffer.mjs'
const { describe, it } = tap.mocha const { describe, it } = test
describe('streamToExistingBuffer()', () => { describe('streamToExistingBuffer()', () => {
it('read the content of a stream in a buffer', async () => { it('read the content of a stream in a buffer', async () => {

View File

@ -1,9 +1,9 @@
import assert from 'assert/strict' import assert from 'assert/strict'
import tap from 'tap' import test from 'test'
import { camelToSnakeCase, diffItems, extractProperty, generateToken, parseSize, parseXml } from './utils.mjs' import { camelToSnakeCase, diffItems, extractProperty, generateToken, parseSize, parseXml } from './utils.mjs'
const { describe, it } = tap.mocha const { describe, it } = test
// =================================================================== // ===================================================================

View File

@ -1,9 +1,9 @@
import assert from 'assert/strict' import assert from 'assert/strict'
import forEach from 'lodash/forEach.js' import forEach from 'lodash/forEach.js'
import tap from 'tap' import test from 'node:test'
import { resolveParamsVector } from './execute-call.mjs' import { resolveParamsVector } from './execute-call.mjs'
const { describe, it } = tap.mocha const { describe, it } = test
describe('resolveParamsVector', function () { describe('resolveParamsVector', function () {
forEach( forEach(