Registry / testing / msgpack-test-js

msgpack-test-js

JSON →
library1.0.0jsnpmunverified

A driver for running the msgpack compatibility test suite in Node.js. Version 1.0.0, no recent updates (as of 2018). It provides the Exam class to fetch and iterate over test cases from the msgpack-test-suite, allowing developers to verify their msgpack encoder/decoder implementations. Differentiates by offering a structured way to run standardized tests across multiple msgpack libraries.

npm install msgpack-test-js
INSTALL
IMPORT
SIG · MSGPACK-TEST-JS
M
msgpack-test-js
testingjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Exam
import { Exam } from 'msgpack-test-js'
const Exam = require('msgpack-test-js')
TypeScript and ESM-compatible; default export is not available.
default
import msgpackTest from 'msgpack-test-js'
const msgpackTest = require('msgpack-test-js').default
No default export; use named import instead.
Exam type
import type { Exam } from 'msgpack-test-js'
import { Exam } from 'msgpack-test-js'
Type import for TypeScript users to avoid runtime inclusion.

Shows how to use Exam.getExams to iterate over test cases and verify encode/decode with msgpack-lite.

import { Exam } from 'msgpack-test-js'; import * as msgpack from 'msgpack-lite'; import assert from 'assert'; const TEST_TYPES = { array: 1, bignum: 1, binary: 1, bool: 1, map: 1, nil: 1, number: 1, string: 1, timestamp: 0 }; const exams = Exam.getExams(TEST_TYPES); exams.forEach(exam => { const types = exam.getTypes(TEST_TYPES); types.forEach(type => { const value = exam.getValue(type); const encoded = msgpack.encode(value); assert.ok(exam.matchMsgpack(encoded), `Failed to encode ${type}`); }); const msgpacks = exam.getMsgpacks(); msgpacks.forEach((encoded, idx) => { const decoded = msgpack.decode(encoded); assert.ok(exam.matchValue(decoded), `Failed to decode index ${idx}`); }); });
Debug
Known issues
gotchaExam.getExams requires an object with type keys and boolean values; using numbers (0/1) is conventional but not enforced.
fix
Use boolean true/false for enabled types instead of numbers.
affects: >=1.0.0
gotchaThe package has not been updated since 2018; the test suite may not cover newer msgpack extensions.
fix
Check the msgpack-test-suite repository for updates and manually adjust.
affects: *
deprecatedThe package uses older JavaScript patterns (var, CommonJS in examples); TypeScript types may be incomplete.
fix
Use with strict TypeScript settings; verify type coverage.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'msgpack-test-suite'
The package expects msgpack-test-suite to be installed globally or as a peer dependency.
fix
Run 'npm install --save-dev msgpack-test-suite' or install it globally.
TypeError: Exam.getExams is not a function
Importing the default export instead of the named Exam.
fix
Use 'import { Exam } from 'msgpack-test-js''.
Error: Exam is not a constructor
Trying to instantiate Exam with 'new Exam()' instead of using static methods.
fix
Use 'Exam.getExams(...)' instead.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
msgpack-test-js — npm install msgpack-test-js · libregistry