mirror of https://codeberg.org/pzp/pzp-db.git
Try to start typechecking tests
This commit is contained in:
parent
8e6128f238
commit
aafb1eea52
|
@ -483,10 +483,10 @@ function initDB(peer, config) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {CB<void>} cb
|
||||
* @param {CB<void> | void} cb
|
||||
*/
|
||||
function loaded(cb) {
|
||||
if (cb === void 0) return promisify(loaded)()
|
||||
if (!cb) return promisify(loaded)()
|
||||
return scannedLog.onDone(() => {
|
||||
ghosts.onReady(cb)
|
||||
})
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
],
|
||||
"types": "types/index.d.ts",
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
"node": ">=18"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
|
@ -49,6 +49,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/b4a": "^1.6.0",
|
||||
"@types/node": "^20.0.0",
|
||||
"@types/pull-stream": "^3.6.7",
|
||||
"c8": "^7.11.0",
|
||||
"flumecodec": "~0.0.1",
|
||||
|
|
|
@ -6,7 +6,6 @@ const os = require('node:os')
|
|||
const rimraf = require('rimraf')
|
||||
const Keypair = require('pzp-keypair')
|
||||
const { createPeer } = require('./util')
|
||||
const MsgV4 = require('../lib/msg-v4')
|
||||
|
||||
const DIR = path.join(os.tmpdir(), 'pzp-db-account-add')
|
||||
rimraf.sync(DIR)
|
||||
|
|
23
test/util.js
23
test/util.js
|
@ -1,9 +1,32 @@
|
|||
/**
|
||||
* @typedef {ReturnType<import('pzp-db').init>} PZPDB
|
||||
* @typedef {import('node:events').EventEmitter} Emitter
|
||||
* @typedef {{ pubkey: string }} SHSE
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Emitter & {
|
||||
* db: PZPDB,
|
||||
* shse: SHSE
|
||||
* close(cb: () => void): void
|
||||
* }} Peer
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {unknown} globalConfig
|
||||
* @returns {Peer}
|
||||
*/
|
||||
function createPeer(globalConfig) {
|
||||
// @ts-ignore
|
||||
return require('secret-stack/bare')()
|
||||
// @ts-ignore
|
||||
.use(require('secret-stack/plugins/net'))
|
||||
.use(require('secret-handshake-ext/secret-stack'))
|
||||
.use(require('../lib'))
|
||||
// @ts-ignore
|
||||
.use(require('ssb-box'))
|
||||
// @ts-ignore
|
||||
.call(null, { shse: { caps: require('pzp-caps') }, global: globalConfig })
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"include": [
|
||||
"declarations",
|
||||
"lib/**/*.js"
|
||||
"lib/**/*.js",
|
||||
"test/"
|
||||
],
|
||||
"exclude": [
|
||||
"coverage/",
|
||||
"node_modules/",
|
||||
"test/"
|
||||
"node_modules/"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"checkJs": true,
|
||||
|
|
Loading…
Reference in New Issue