diff options
author | Ruy Adorno <ruyadorno@hotmail.com> | 2020-07-30 00:08:24 +0300 |
---|---|---|
committer | Ruy Adorno <ruyadorno@hotmail.com> | 2020-07-30 00:08:24 +0300 |
commit | 83f4a0914de25e9ea03191d8dc6ffc8dbb73bb3a (patch) | |
tree | 3ba088988c4da356ed4aa0e2245cfb75a69677fb | |
parent | 2652baaf7cab47c58360ebbecaf951fa8b9e1862 (diff) |
fix: test/lib/publish.js test
-rw-r--r-- | tap-snapshots/test-lib-publish.js-TAP.test.js | 2 | ||||
-rw-r--r-- | test/lib/publish.js | 16 |
2 files changed, 6 insertions, 12 deletions
diff --git a/tap-snapshots/test-lib-publish.js-TAP.test.js b/tap-snapshots/test-lib-publish.js-TAP.test.js index 08e2bbc75..61f38294d 100644 --- a/tap-snapshots/test-lib-publish.js-TAP.test.js +++ b/tap-snapshots/test-lib-publish.js-TAP.test.js @@ -5,7 +5,7 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' -exports[`test/lib/publish.js TAP shows usage with wrong set of arguments > must match snapshot 1`] = ` +exports[`test/lib/publish.js TAP shows usage with wrong set of arguments > should print usage 1`] = ` npm publish [<folder>] [--tag <tag>] [--access <public|restricted>] [--dry-run] Publishes '.' if no argument supplied diff --git a/test/lib/publish.js b/test/lib/publish.js index 15a876297..627cb71f8 100644 --- a/test/lib/publish.js +++ b/test/lib/publish.js @@ -121,7 +121,7 @@ test('should log tarball contents', (t) => { }) }) -test('shows usage with wrong set of arguments', async (t) => { +test('shows usage with wrong set of arguments', (t) => { const publish = requireInject('../../lib/publish.js', { '../../lib/npm.js': { flatOptions: { @@ -131,16 +131,10 @@ test('shows usage with wrong set of arguments', async (t) => { } }) - const printUsage = async () => { - let usage - await publish(['a', 'b', 'c'], (str) => { - if (str) usage = str - }) - return usage - } - const info = await printUsage() - - t.matchSnapshot(info) + publish(['a', 'b', 'c'], (result) => { + t.matchSnapshot(result, 'should print usage') + t.end() + }) }) test('throws when invalid tag', (t) => { |