diff --git a/packages/formatter-progress-bar/.madrun.mjs b/packages/formatter-progress-bar/.madrun.mjs index aa0aa7f..e0d9916 100644 --- a/packages/formatter-progress-bar/.madrun.mjs +++ b/packages/formatter-progress-bar/.madrun.mjs @@ -1,7 +1,12 @@ import {run} from 'madrun'; +const NODE_OPTIONS = `'--loader mock-import --no-warnings'`; +const env = { + NODE_OPTIONS, +} + export default { - 'test': () => `supertape 'lib/**/*.spec.js'`, + 'test': () => [env, `supertape 'lib/**/*.spec.js'`], 'watch:test': async () => `nodemon -w lib -w test -x "${await run('test')}"`, 'lint': () => 'putout .', 'fresh:lint': () => run('lint', '--fresh'), diff --git a/packages/formatter-progress-bar/lib/progress-bar.js b/packages/formatter-progress-bar/lib/progress-bar.js index dfabc96..d81f651 100644 --- a/packages/formatter-progress-bar/lib/progress-bar.js +++ b/packages/formatter-progress-bar/lib/progress-bar.js @@ -1,12 +1,10 @@ -'use strict'; +import {Writable} from 'stream'; -const {Writable} = require('stream'); - -const cliProgress = require('cli-progress'); -const chalk = require('chalk'); -const once = require('once'); -const fullstore = require('fullstore'); -const {isCI} = require('ci-info'); +import cliProgress from 'cli-progress'; +import chalk from 'chalk'; +import once from 'once'; +import fullstore from 'fullstore'; +import {isCI} from 'ci-info'; const OK = '👌'; const YELLOW = '#f9d472'; @@ -28,7 +26,7 @@ const { let bar; -module.exports.start = ({total}) => { +export const start = ({total}) => { out('TAP version 13'); const color = SUPERTAPE_PROGRESS_BAR_COLOR || YELLOW; @@ -40,11 +38,11 @@ module.exports.start = ({total}) => { }); }; -module.exports.test = ({test}) => { +export const test = ({test}) => { store(`# ${test}`); }; -module.exports.testEnd = ({count, total, failed, test}) => { +export const testEnd = ({count, total, failed, test}) => { bar.increment({ count, total, @@ -53,7 +51,7 @@ module.exports.testEnd = ({count, total, failed, test}) => { }); }; -module.exports.fail = ({at, count, message, operator, actual, expected, output, errorStack}) => { +export const fail = ({at, count, message, operator, actual, expected, output, errorStack}) => { out(''); out(store()); out(`❌ not ok ${count} ${message}`); @@ -81,7 +79,7 @@ module.exports.fail = ({at, count, message, operator, actual, expected, output, out(''); }; -module.exports.end = ({count, passed, failed, skiped}) => { +export const end = ({count, passed, failed, skiped}) => { bar.stop(); out(''); @@ -142,7 +140,7 @@ const getStream = ({total} = defaultStreamOptions) => { return new Writable(); }; -module.exports._getStream = getStream; +export const _getStream = getStream; const createProgress = once(({total, color, test}) => { const colorFn = getColorFn(color); diff --git a/packages/formatter-progress-bar/lib/progress-bar.spec.js b/packages/formatter-progress-bar/lib/progress-bar.spec.js index 07e492e..93902ab 100644 --- a/packages/formatter-progress-bar/lib/progress-bar.spec.js +++ b/packages/formatter-progress-bar/lib/progress-bar.spec.js @@ -1,12 +1,15 @@ -'use strict'; +import {createMockImport, + enableNestedImports, + disableNestedImports, +} from 'mock-import'; +import {once} from 'events'; -const {once} = require('events'); - -const montag = require('montag'); -const mockRequire = require('mock-require'); -const {reRequire, stopAll} = mockRequire; -const pullout = require('pullout'); -const {test, stub} = require('supertape'); +import montag from 'montag'; +import pullout from 'pullout'; +import { + test, + stub, +} from 'supertape'; const {env} = process; @@ -21,6 +24,13 @@ const pull = async (stream, i = 9) => { .join('\n'); }; +const { + reImport, + reImportDefault, + mockImport, + stopAll, +} = createMockImport(import.meta.url); + test('supertape: format: progress bar', async (t) => { const successFn = (t) => { t.ok(true); @@ -39,9 +49,9 @@ test('supertape: format: progress bar', async (t) => { const {CI} = env; env.CI = 1; - reRequire('ci-info'); - reRequire('./progress-bar'); - const supertape = reRequire('supertape'); + await reImport('ci-info'); + await reImport('./progress-bar'); + const supertape = await reImport('supertape'); supertape.init({ quiet: true, @@ -52,7 +62,7 @@ test('supertape: format: progress bar', async (t) => { supertape(failMessage, failFn); const [result] = await Promise.all([ - pull(supertape.createStream(), 10), + pull(await supertape.createStream(), 10), once(supertape.run(), 'end'), ]); @@ -86,9 +96,9 @@ test('supertape: format: progress bar: diff', async (t) => { const {CI} = env; env.CI = 1; - reRequire('ci-info'); - reRequire('./progress-bar'); - const supertape = reRequire('supertape'); + await reImport('ci-info'); + await reImport('./progress-bar'); + const supertape = await reImport('supertape'); supertape.init({ quiet: true, @@ -98,7 +108,7 @@ test('supertape: format: progress bar: diff', async (t) => { supertape(message, fn); const [result] = await Promise.all([ - pull(supertape.createStream()), + pull(await supertape.createStream()), once(supertape.run(), 'end'), ]); @@ -130,9 +140,9 @@ test('supertape: format: progress bar: success', async (t) => { env.CI = 1; - reRequire('ci-info'); - reRequire('./progress-bar'); - const supertape = reRequire('supertape'); + await reImport('ci-info'); + await reImport('./progress-bar'); + const supertape = await reImport('supertape'); supertape.init({ quiet: true, @@ -142,7 +152,7 @@ test('supertape: format: progress bar: success', async (t) => { supertape(message, fn); const [result] = await Promise.all([ - pull(supertape.createStream(), 8), + pull(await supertape.createStream(), 8), once(supertape.run(), 'end'), ]); @@ -173,9 +183,9 @@ test('supertape: format: progress bar: skip', async (t) => { const {CI} = env; env.CI = 1; - reRequire('ci-info'); - reRequire('./progress-bar'); - const supertape = reRequire('supertape'); + await reImport('ci-info'); + await reImport('./progress-bar'); + const supertape = await reImport('supertape'); supertape.init({ quiet: true, @@ -185,7 +195,7 @@ test('supertape: format: progress bar: skip', async (t) => { supertape.skip(message, fn); const [result] = await Promise.all([ - pull(supertape.createStream(), 8), + pull(await supertape.createStream(), 8), once(supertape.run(), 'end'), ]); @@ -218,9 +228,9 @@ test('supertape: format: progress bar: color', async (t) => { env.CI = 1; env.SUPERTAPE_PROGRESS_BAR_COLOR = 'red'; - reRequire('ci-info'); - reRequire('./progress-bar'); - const supertape = reRequire('supertape'); + await reImport('ci-info'); + await reImport('./progress-bar'); + const supertape = await reImport('supertape'); supertape.init({ quiet: true, @@ -230,7 +240,7 @@ test('supertape: format: progress bar: color', async (t) => { supertape(message, fn); const [result] = await Promise.all([ - pull(supertape.createStream(), 8), + pull(await supertape.createStream(), 8), once(supertape.run(), 'end'), ]); @@ -251,7 +261,7 @@ test('supertape: format: progress bar: color', async (t) => { t.end(); }); -test('supertape: format: progress bar: getStream: no SUPERTAPE_PROGRESS_BAR', (t) => { +test('supertape: format: progress bar: getStream: no SUPERTAPE_PROGRESS_BAR', async (t) => { const { CI, SUPERTAPE_PROGRESS_BAR, @@ -260,8 +270,8 @@ test('supertape: format: progress bar: getStream: no SUPERTAPE_PROGRESS_BAR', (t env.SUPERTAPE_PROGRESS_BAR = 0; env.CI = 1; - reRequire('ci-info'); - const {_getStream} = reRequire('./progress-bar'); + await reImport('ci-info'); + const {_getStream} = await reImport('./progress-bar'); const stream = _getStream({ total: 1, }); @@ -273,7 +283,7 @@ test('supertape: format: progress bar: getStream: no SUPERTAPE_PROGRESS_BAR', (t t.end(); }); -test('supertape: format: progress bar: getStream: SUPERTAPE_PROGRESS_BAR', (t) => { +test('supertape: format: progress bar: getStream: SUPERTAPE_PROGRESS_BAR', async (t) => { const { CI, SUPERTAPE_PROGRESS_BAR, @@ -281,8 +291,8 @@ test('supertape: format: progress bar: getStream: SUPERTAPE_PROGRESS_BAR', (t) = env.SUPERTAPE_PROGRESS_BAR = 1; env.CI = 1; - reRequire('ci-info'); - const {_getStream} = reRequire('./progress-bar'); + await reImport('ci-info'); + const {_getStream} = await reImport('./progress-bar'); const stream = _getStream({ total: 100, }); @@ -294,7 +304,7 @@ test('supertape: format: progress bar: getStream: SUPERTAPE_PROGRESS_BAR', (t) = t.end(); }); -test('supertape: format: progress bar: getStream: SUPERTAPE_PROGRESS_BAR, no CI', (t) => { +test('supertape: format: progress bar: getStream: SUPERTAPE_PROGRESS_BAR, no CI', async (t) => { const { CI, SUPERTAPE_PROGRESS_BAR, @@ -303,8 +313,8 @@ test('supertape: format: progress bar: getStream: SUPERTAPE_PROGRESS_BAR, no CI' env.SUPERTAPE_PROGRESS_BAR = 1; delete env.CI; - reRequire('ci-info'); - const {_getStream} = reRequire('./progress-bar'); + await reImport('ci-info'); + const {_getStream} = await reImport('./progress-bar'); const stream = _getStream(); env.CI = CI; @@ -314,22 +324,22 @@ test('supertape: format: progress bar: getStream: SUPERTAPE_PROGRESS_BAR, no CI' t.end(); }); -test('supertape: format: progress bar: testEnd', (t) => { +test('supertape: format: progress bar: testEnd', async (t) => { const increment = stub(); const SingleBar = stub().returns({ start: stub(), increment, }); - mockRequire('cli-progress', { + mockImport('cli-progress', { SingleBar, Presets: { React: {}, }, }); - reRequire('once'); - const {start, testEnd} = reRequire('./progress-bar'); + await reImport('once'); + const {start, testEnd} = await reImport('./progress-bar'); start({total: 10}); const count = 1; @@ -357,7 +367,7 @@ test('supertape: format: progress bar: testEnd', (t) => { t.end(); }); -test('supertape: format: progress bar: no stack', async (t) => { +test.only('supertape: format: progress bar: no stack', async (t) => { const fn = (t) => { t.ok(false); t.end(); @@ -369,9 +379,16 @@ test('supertape: format: progress bar: no stack', async (t) => { env.CI = 1; env.SUPERTAPE_PROGRESS_BAR_STACK = 0; - reRequire('ci-info'); - reRequire('./progress-bar'); - const supertape = reRequire('supertape'); + enableNestedImports(); + + await reImport('ci-info'); + await reImport('./progress-bar'); + await reImport('once'); + + debugger; + const supertape = await reImportDefault('supertape'); + + disableNestedImports(); supertape.init({ quiet: true, @@ -379,12 +396,16 @@ test('supertape: format: progress bar: no stack', async (t) => { }); supertape(message, fn); - + + debugger; + console.log('bbb'); const [output] = await Promise.all([ - pull(supertape.createStream(), 18), + pull(await supertape.createStream(), 18), once(supertape.run(), 'end'), ]); + console.log('zzzz'); + const result = output.replace(/at .+\n/, 'at xxx\n'); delete env.SUPERTAPE_PROGRESS_BAR_STACK; @@ -414,3 +435,4 @@ test('supertape: format: progress bar: no stack', async (t) => { t.equal(result, expected); t.end(); }); + diff --git a/packages/formatter-progress-bar/package.json b/packages/formatter-progress-bar/package.json index a3479fa..6ad54ef 100644 --- a/packages/formatter-progress-bar/package.json +++ b/packages/formatter-progress-bar/package.json @@ -8,7 +8,7 @@ "release": false, "tag": false, "changelog": false, - "type": "commonjs", + "type": "module", "repository": { "type": "git", "url": "git://github.com/coderaiser/supertape.git" @@ -41,6 +41,7 @@ "eslint-plugin-node": "^11.1.0", "eslint-plugin-putout": "^12.0.0", "madrun": "^8.0.0", + "mock-import": "^2.5.0", "mock-require": "^3.0.2", "montag": "^1.0.0", "nodemon": "^2.0.2", diff --git a/packages/supertape/lib/cli.js b/packages/supertape/lib/cli.js index 902d3bc..be5de9b 100644 --- a/packages/supertape/lib/cli.js +++ b/packages/supertape/lib/cli.js @@ -165,7 +165,7 @@ async function cli({argv, cwd, stdout, isStop}) { checkAssertionsCount, }); - supertape.createStream().pipe(stdout); + (await supertape.createStream()).pipe(stdout); const promises = []; const files = removeDuplicates(allFiles); diff --git a/packages/supertape/lib/formatter/index.js b/packages/supertape/lib/formatter/index.js index ecc4700..dae8acd 100644 --- a/packages/supertape/lib/formatter/index.js +++ b/packages/supertape/lib/formatter/index.js @@ -3,13 +3,13 @@ const {EventEmitter} = require('events'); const {createHarness} = require('./harness'); -const resolveFormatter = (name) => { - return require(`@supertape/formatter-${name}`); +const resolveFormatter = async (name) => { + return await import(`@supertape/formatter-${name}`); }; -module.exports.createFormatter = (name) => { +module.exports.createFormatter = async (name) => { const formatter = new EventEmitter(); - const harness = createHarness(resolveFormatter(name)); + const harness = createHarness(await resolveFormatter(name)); formatter.on('start', ({total}) => { harness.write({ diff --git a/packages/supertape/lib/run-tests.spec.js b/packages/supertape/lib/run-tests.spec.js index 813a8d6..702d029 100644 --- a/packages/supertape/lib/run-tests.spec.js +++ b/packages/supertape/lib/run-tests.spec.js @@ -32,7 +32,7 @@ test('supertape: runTests', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream()), + pull(await supertape.createStream()), once(supertape.run(), 'end'), ]); @@ -68,15 +68,13 @@ test('supertape: runTests: duplicates: node_modules', async (t) => { const StackTracey = stub().returns([{ beforeParse: 'at getDuplicatesMessage (/node_modules/supertape/lib/supertape.js:113:37)', file: '/node_modules/supertape/lib/supertape.js', - }, - { + }, { beforeParse: 'at test (/node_modules/supertape/lib/supertape.js:144:31)', file: '/node_modules/supertape/lib/supertape.js', }, { beforeParse: 'at only (/node_modules/supertape/lib/supertape.js:144:31)', file: '/node_modules/supertape/lib/supertape.js', - }, - { + }, { beforeParse: 'at Object. (/Users/coderaiser/putout/packages/traverse/lib/traverse.spec.js:123:1)', file: '/Users/coderaiser/putout/packages/traverse/lib/traverse.spec.js', }]); @@ -99,7 +97,7 @@ test('supertape: runTests: duplicates: node_modules', async (t) => { const FOUR_TESTS = 30; const [result] = await Promise.all([ - pull(supertape.createStream(), FOUR_TESTS), + pull(await supertape.createStream(), FOUR_TESTS), once(supertape.run(), 'end'), ]); @@ -139,7 +137,7 @@ test('supertape: runTests: duplicates', async (t) => { const FOUR_TESTS = 30; const [result] = await Promise.all([ - pull(supertape.createStream(), FOUR_TESTS), + pull(await supertape.createStream(), FOUR_TESTS), once(supertape.run(), 'end'), ]); @@ -174,7 +172,7 @@ test('supertape: runTests: duplicates: false', async (t) => { const FOUR_TESTS = 30; const [result] = await Promise.all([ - pull(supertape.createStream(), FOUR_TESTS), + pull(await supertape.createStream(), FOUR_TESTS), once(supertape.run(), 'end'), ]); @@ -209,7 +207,7 @@ test('supertape: runTests: duplicates: defaults', async (t) => { const FOUR_TESTS = 30; const [result] = await Promise.all([ - pull(supertape.createStream(), FOUR_TESTS), + pull(await supertape.createStream(), FOUR_TESTS), once(supertape.run(), 'end'), ]); @@ -243,7 +241,7 @@ test('supertape: runTests: duplicates: not match', async (t) => { const FOUR_TESTS = 30; const [result] = await Promise.all([ - pull(supertape.createStream(), FOUR_TESTS), + pull(await supertape.createStream(), FOUR_TESTS), once(supertape.run(), 'end'), ]); @@ -271,7 +269,7 @@ test('supertape: runTests: no duplicates', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream()), + pull(await supertape.createStream()), once(supertape.run(), 'end'), ]); @@ -293,7 +291,7 @@ test('supertape: runTests: fail', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream(), 5), + pull(await supertape.createStream(), 5), once(supertape.run(), 'end'), ]); @@ -326,7 +324,7 @@ test('supertape: runTests: checkAssertionsCount: no assertions', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream(), 5), + pull(await supertape.createStream(), 5), once(supertape.run(), 'end'), ]); @@ -358,7 +356,7 @@ test('supertape: runTests: assertions after t.end()', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream(), 5), + pull(await supertape.createStream(), 5), once(supertape.run(), 'end'), ]); @@ -391,7 +389,7 @@ test('supertape: runTests: a couple t.end()', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream(), 5), + pull(await supertape.createStream(), 5), once(supertape.run(), 'end'), ]); @@ -430,7 +428,7 @@ test('supertape: runTests: assertions after t.end(): async', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream(), 5), + pull(await supertape.createStream(), 5), once(supertape.run(), 'end'), ]); @@ -460,7 +458,7 @@ test('supertape: runTests: fail: at', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream(), 6), + pull(await supertape.createStream(), 6), once(supertape.run(), 'end'), ]); @@ -495,7 +493,7 @@ test('supertape: runTests: fail: timeout', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream(), 5), + pull(await supertape.createStream(), 5), once(supertape.run(), 'end'), ]); @@ -527,7 +525,7 @@ test('supertape: runTests: equal', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream()), + pull(await supertape.createStream()), once(supertape.run(), 'end'), ]); @@ -562,7 +560,7 @@ test('supertape: runTests: not equal', async (t) => { const BEFORE_DIFF = 6; const [result] = await Promise.all([ - pull(supertape.createStream(), BEFORE_DIFF), + pull(await supertape.createStream(), BEFORE_DIFF), once(supertape.run(), 'end'), ]); @@ -594,7 +592,7 @@ test('supertape: runTests: not deepEqual', async (t) => { const BEFORE_DIFF = 6; const [result] = await Promise.all([ - pull(supertape.createStream(), BEFORE_DIFF), + pull(await supertape.createStream(), BEFORE_DIFF), once(supertape.run(), 'end'), ]); @@ -625,7 +623,7 @@ test('supertape: runTests: comment', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream()), + pull(await supertape.createStream()), once(supertape.run(), 'end'), ]); @@ -658,7 +656,7 @@ test('supertape: runTests: crash', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream(), 3), + pull(await supertape.createStream(), 3), once(supertape.run(), 'end'), ]); @@ -686,7 +684,7 @@ test('supertape: runTests: pass', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream()), + pull(await supertape.createStream()), once(supertape.run(), 'end'), ]); @@ -720,7 +718,7 @@ test('supertape: runTests: pass: unnamed', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream()), + pull(await supertape.createStream()), once(supertape.run(), 'end'), ]); @@ -764,7 +762,7 @@ test('supertape: runTests: isStop', async (t) => { supertape(message2, fn2); const [result] = await Promise.all([ - pull(supertape.createStream()), + pull(await supertape.createStream()), once(supertape.run(), 'end'), ]); @@ -806,7 +804,7 @@ test('supertape: runTests: not equal, but deepEqual', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream(), 6), + pull(await supertape.createStream(), 6), once(supertape.run(), 'end'), ]); @@ -840,7 +838,7 @@ test('supertape: runTests: is debug', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream()), + pull(await supertape.createStream()), once(supertape.run(), 'end'), ]); diff --git a/packages/supertape/lib/supertape.js b/packages/supertape/lib/supertape.js index 7a40548..817328f 100644 --- a/packages/supertape/lib/supertape.js +++ b/packages/supertape/lib/supertape.js @@ -64,7 +64,7 @@ function _createEmitter({quiet, format, getOperators, isStop}) { }); emitter.on('run', async () => { - const {harness, formatter} = createFormatter(format); + const {harness, formatter} = await createFormatter(format); if (!quiet) harness.pipe(stdout); @@ -92,9 +92,9 @@ module.exports.init = (options) => { assign(initedOptions, options); }; -const createStream = () => { +const createStream = async () => { const {format} = initedOptions; - const {harness} = createFormatter(format); + const {harness} = await createFormatter(format); return harness; }; diff --git a/packages/supertape/lib/supertape.spec.js b/packages/supertape/lib/supertape.spec.js index 10bb7ef..02e9089 100644 --- a/packages/supertape/lib/supertape.spec.js +++ b/packages/supertape/lib/supertape.spec.js @@ -29,7 +29,7 @@ test('supertape: equal', async (t) => { }); supertape(message, fn); - const stream = supertape.createStream(); + const stream = await supertape.createStream(); const [result] = await Promise.all([ pull(stream), @@ -67,7 +67,7 @@ test('supertape: stack trace', async (t) => { }); supertape(message, fn); - const stream = supertape.createStream(); + const stream = await supertape.createStream(); const [result] = await Promise.all([ pull(stream, -3), @@ -102,7 +102,7 @@ test('supertape: stack strace: exception', async (t) => { fn(); t.end(); }); - const stream = supertape.createStream(); + const stream = await supertape.createStream(); const [output] = await Promise.all([ pull(stream, -3), @@ -148,7 +148,7 @@ test('supertape: checkDuplicates: override', async (t) => { checkDuplicates: false, }); - const stream = supertape.createStream(); + const stream = await supertape.createStream(); const [result] = await Promise.all([ pull(stream), @@ -192,7 +192,7 @@ test('supertape: checkAssertionsCount: override', async (t) => { checkAssertionsCount: true, }); - const stream = supertape.createStream(); + const stream = await supertape.createStream(); const [result] = await Promise.all([ pull(stream), @@ -238,7 +238,7 @@ test('supertape: deepEqual', async (t) => { }); supertape(message, fn); - const stream = supertape.createStream(); + const stream = await supertape.createStream(); const [result] = await Promise.all([ pull(stream), @@ -274,7 +274,7 @@ test('supertape: createStream', async (t) => { quiet: true, }); - const stream = supertape.createStream(); + const stream = await supertape.createStream(); supertape(message, fn); @@ -312,7 +312,7 @@ test('supertape: skip', async (t) => { quiet: true, }); - const stream = supertape.createStream(); + const stream = await supertape.createStream(); const [result] = await Promise.all([ pull(stream), @@ -360,7 +360,7 @@ test('supertape: only', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream()), + pull(await supertape.createStream()), once(emitter, 'end'), ]); @@ -402,7 +402,7 @@ test('supertape: extensions', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream()), + pull(await supertape.createStream()), once(emitter, 'end'), ]); @@ -444,7 +444,7 @@ test('supertape: extensions: extend', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream()), + pull(await supertape.createStream()), once(emitter, 'end'), ]); @@ -492,7 +492,7 @@ test('supertape: extensions: extend: no return', async (t) => { `; const [result] = await Promise.all([ - pull(supertape.createStream(), expected.length), + pull(await supertape.createStream(), expected.length), once(emitter, 'end'), ]); @@ -528,7 +528,7 @@ test('supertape: extensions: extend: return function', async (t) => { `; const [result] = await Promise.all([ - pull(supertape.createStream(), expected.length), + pull(await supertape.createStream(), expected.length), once(emitter, 'end'), ]); @@ -558,7 +558,7 @@ test('supertape: extensions: extend: async', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream()), + pull(await supertape.createStream()), once(emitter, 'end'), ]); @@ -600,7 +600,7 @@ test('supertape: extensions: extend: only', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream()), + pull(await supertape.createStream()), once(emitter, 'end'), ]); @@ -642,7 +642,7 @@ test('supertape: extensions: extend: skip', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream()), + pull(await supertape.createStream()), once(emitter, 'end'), ]); @@ -689,7 +689,7 @@ test('supertape: quiet: false', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream()), + pull(await supertape.createStream()), once(emitter, 'end'), ]); @@ -729,7 +729,7 @@ test('supertape: destructuring test', async (t) => { }); supertape.test(message, fn); - const stream = supertape.createStream(); + const stream = await supertape.createStream(); const [result] = await Promise.all([ pull(stream), @@ -778,7 +778,7 @@ test('supertape: destructuring test: only', async (t) => { }); const [result] = await Promise.all([ - pull(supertape.createStream()), + pull(await supertape.createStream()), once(emitter, 'end'), ]); @@ -812,7 +812,7 @@ test('supertape: destructuring test: skip', async (t) => { quiet: true, }); - const stream = supertape.createStream(); + const stream = await supertape.createStream(); const [result] = await Promise.all([ pull(stream), @@ -852,7 +852,7 @@ test('supertape: duplicate', async (t) => { supertape(message, fn); supertape(message, fn); - const stream = supertape.createStream(); + const stream = await supertape.createStream(); const [result] = await Promise.all([ pull(stream, 62), diff --git a/packages/supertape/package.json b/packages/supertape/package.json index 017d3ce..d06bd30 100644 --- a/packages/supertape/package.json +++ b/packages/supertape/package.json @@ -7,11 +7,8 @@ "main": "./lib/supertape.js", "exports": { ".": { - "node": { - "require": "./lib/supertape.js", - "import": "./lib/supertape.mjs" - }, - "default": "./lib/supertape.js" + "require": "./lib/supertape.js", + "import": "./lib/supertape.mjs" }, "./bin/supertape": "./bin/supertape.mjs", "./cli": "./lib/cli.js" @@ -48,7 +45,6 @@ "@supertape/formatter-short": "^1.0.0", "@supertape/formatter-tap": "^2.0.0", "@supertape/operator-stub": "^1.0.0", - "chalk": "^4.1.0", "cli-progress": "^3.8.2", "deep-equal": "^2.0.3", "fullstore": "^3.0.0",