Skip to content

Commit

Permalink
expose tap/mocha
Browse files Browse the repository at this point in the history
Fix: #818
PR-URL: #822
Credit: @GeekyDeaks
Close: #822
Reviewed-by: @isaacs
  • Loading branch information
GeekyDeaks authored and isaacs committed Jun 17, 2022
1 parent 73e3f7e commit 93ee27c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"default": "./lib/tap.js"
},
"./*": "./*",
"./": "./"
"./": "./",
"./mocha": "./lib/mocha.js"
},
"engines": {
"node": ">=12"
Expand Down
16 changes: 16 additions & 0 deletions tap-snapshots/test/test.mjs.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@
* Make sure to inspect the output below. Do not ignore changes!
*/
'use strict'
exports[`test/test.mjs TAP mocha export > must match snapshot 1`] = `
Array [
"after",
"afterEach",
"before",
"beforeEach",
"context",
"default",
"deglobal",
"describe",
"global",
"it",
"specify",
]
`

exports[`test/test.mjs TAP tap > must match snapshot 1`] = `
Array [
"Spawn",
Expand Down
10 changes: 9 additions & 1 deletion test/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (typeof createRequire !== 'function') {
process.exit(0)
}

const require = createRequire(import.meta.url);
const require = createRequire(import.meta.url)

const cjs = require('tap');

Expand All @@ -23,3 +23,11 @@ t.test('tap', async t => {
t.equal(tap[key], key === 'default' ? cjs : cjs[key], key)
}
})

import * as mocha from 'tap/mocha'
t.test('mocha export', async t => {
t.matchSnapshot(Object.keys(mocha).sort())
for (const key of Object.keys(mocha)) {
t.equal(mocha[key], key === 'default' ? cjs.mocha : cjs.mocha[key], key)
}
})

0 comments on commit 93ee27c

Please sign in to comment.