diff options
author | isaacs <i@izs.me> | 2020-11-17 04:56:54 +0300 |
---|---|---|
committer | Ruy Adorno <ruyadorno@hotmail.com> | 2020-11-17 22:38:18 +0300 |
commit | b1d850960fda95650cd828a7bd8586648d9e2672 (patch) | |
tree | 2f9f436ccdf8b97bcaa87a5e0d236c33068d9444 /test/lib/repo.js | |
parent | de82b6257d6cb81809be8f9e290d4962929e0c25 (diff) |
lint tests before publishing
We have a lot of tests that were not handling errors in callbacks, not
defining variables, defining variables that weren't used, and just
generally not formatted like the rest of npm.
Hazard of moving fast. Thankfully, machines can help.
Diffstat (limited to 'test/lib/repo.js')
-rw-r--r-- | test/lib/repo.js | 186 |
1 files changed, 93 insertions, 93 deletions
diff --git a/test/lib/repo.js b/test/lib/repo.js index fcc95f343..c4b1b46e7 100644 --- a/test/lib/repo.js +++ b/test/lib/repo.js @@ -5,105 +5,105 @@ const pacote = { manifest: async (spec, options) => { return spec === 'norepo' ? { name: 'norepo', - version: '1.2.3' + version: '1.2.3', } - : spec === 'repoobbj-nourl' ? { - name: 'repoobj-nourl', - repository: { no: 'url' } - } + : spec === 'repoobbj-nourl' ? { + name: 'repoobj-nourl', + repository: { no: 'url' }, + } - : spec === 'hostedgit' ? { - repository: 'git://github.com/foo/hostedgit' - } - : spec === 'hostedgitat' ? { - repository: 'git@github.com:foo/hostedgitat' - } - : spec === 'hostedssh' ? { - repository: 'ssh://git@github.com/foo/hostedssh' - } - : spec === 'hostedgitssh' ? { - repository: 'git+ssh://git@github.com/foo/hostedgitssh' - } - : spec === 'hostedgithttp' ? { - repository: 'git+http://github.com/foo/hostedgithttp' - } - : spec === 'hostedgithttps' ? { - repository: 'git+https://github.com/foo/hostedgithttps' - } + : spec === 'hostedgit' ? { + repository: 'git://github.com/foo/hostedgit', + } + : spec === 'hostedgitat' ? { + repository: 'git@github.com:foo/hostedgitat', + } + : spec === 'hostedssh' ? { + repository: 'ssh://git@github.com/foo/hostedssh', + } + : spec === 'hostedgitssh' ? { + repository: 'git+ssh://git@github.com/foo/hostedgitssh', + } + : spec === 'hostedgithttp' ? { + repository: 'git+http://github.com/foo/hostedgithttp', + } + : spec === 'hostedgithttps' ? { + repository: 'git+https://github.com/foo/hostedgithttps', + } - : spec === 'hostedgitobj' ? { - repository: { url: 'git://github.com/foo/hostedgitobj' } - } - : spec === 'hostedgitatobj' ? { - repository: { url: 'git@github.com:foo/hostedgitatobj' } - } - : spec === 'hostedsshobj' ? { - repository: { url: 'ssh://git@github.com/foo/hostedsshobj' } - } - : spec === 'hostedgitsshobj' ? { - repository: { url: 'git+ssh://git@github.com/foo/hostedgitsshobj' } - } - : spec === 'hostedgithttpobj' ? { - repository: { url: 'git+http://github.com/foo/hostedgithttpobj' } - } - : spec === 'hostedgithttpsobj' ? { - repository: { url: 'git+https://github.com/foo/hostedgithttpsobj' } - } + : spec === 'hostedgitobj' ? { + repository: { url: 'git://github.com/foo/hostedgitobj' }, + } + : spec === 'hostedgitatobj' ? { + repository: { url: 'git@github.com:foo/hostedgitatobj' }, + } + : spec === 'hostedsshobj' ? { + repository: { url: 'ssh://git@github.com/foo/hostedsshobj' }, + } + : spec === 'hostedgitsshobj' ? { + repository: { url: 'git+ssh://git@github.com/foo/hostedgitsshobj' }, + } + : spec === 'hostedgithttpobj' ? { + repository: { url: 'git+http://github.com/foo/hostedgithttpobj' }, + } + : spec === 'hostedgithttpsobj' ? { + repository: { url: 'git+https://github.com/foo/hostedgithttpsobj' }, + } - : spec === 'unhostedgit' ? { - repository: 'git://gothib.com/foo/unhostedgit' - } - : spec === 'unhostedgitat' ? { - repository: 'git@gothib.com:foo/unhostedgitat' - } - : spec === 'unhostedssh' ? { - repository: 'ssh://git@gothib.com/foo/unhostedssh' - } - : spec === 'unhostedgitssh' ? { - repository: 'git+ssh://git@gothib.com/foo/unhostedgitssh' - } - : spec === 'unhostedgithttp' ? { - repository: 'git+http://gothib.com/foo/unhostedgithttp' - } - : spec === 'unhostedgithttps' ? { - repository: 'git+https://gothib.com/foo/unhostedgithttps' - } + : spec === 'unhostedgit' ? { + repository: 'git://gothib.com/foo/unhostedgit', + } + : spec === 'unhostedgitat' ? { + repository: 'git@gothib.com:foo/unhostedgitat', + } + : spec === 'unhostedssh' ? { + repository: 'ssh://git@gothib.com/foo/unhostedssh', + } + : spec === 'unhostedgitssh' ? { + repository: 'git+ssh://git@gothib.com/foo/unhostedgitssh', + } + : spec === 'unhostedgithttp' ? { + repository: 'git+http://gothib.com/foo/unhostedgithttp', + } + : spec === 'unhostedgithttps' ? { + repository: 'git+https://gothib.com/foo/unhostedgithttps', + } - : spec === 'unhostedgitobj' ? { - repository: { url: 'git://gothib.com/foo/unhostedgitobj' } - } - : spec === 'unhostedgitatobj' ? { - repository: { url: 'git@gothib.com:foo/unhostedgitatobj' } - } - : spec === 'unhostedsshobj' ? { - repository: { url: 'ssh://git@gothib.com/foo/unhostedsshobj' } - } - : spec === 'unhostedgitsshobj' ? { - repository: { url: 'git+ssh://git@gothib.com/foo/unhostedgitsshobj' } - } - : spec === 'unhostedgithttpobj' ? { - repository: { url: 'git+http://gothib.com/foo/unhostedgithttpobj' } - } - : spec === 'unhostedgithttpsobj' ? { - repository: { url: 'git+https://gothib.com/foo/unhostedgithttpsobj' } - } + : spec === 'unhostedgitobj' ? { + repository: { url: 'git://gothib.com/foo/unhostedgitobj' }, + } + : spec === 'unhostedgitatobj' ? { + repository: { url: 'git@gothib.com:foo/unhostedgitatobj' }, + } + : spec === 'unhostedsshobj' ? { + repository: { url: 'ssh://git@gothib.com/foo/unhostedsshobj' }, + } + : spec === 'unhostedgitsshobj' ? { + repository: { url: 'git+ssh://git@gothib.com/foo/unhostedgitsshobj' }, + } + : spec === 'unhostedgithttpobj' ? { + repository: { url: 'git+http://gothib.com/foo/unhostedgithttpobj' }, + } + : spec === 'unhostedgithttpsobj' ? { + repository: { url: 'git+https://gothib.com/foo/unhostedgithttpsobj' }, + } - : spec === 'directory' ? { - repository: { - type: 'git', - url: 'git+https://github.com/foo/test-repo-with-directory.git', - directory: 'some/directory' + : spec === 'directory' ? { + repository: { + type: 'git', + url: 'git+https://github.com/foo/test-repo-with-directory.git', + directory: 'some/directory', + }, } - } - : spec === '.' ? { - name: 'thispkg', - version: '1.2.3', - repository: 'https://example.com/thispkg.git' - } - : null - } + : spec === '.' ? { + name: 'thispkg', + version: '1.2.3', + repository: 'https://example.com/thispkg.git', + } + : null + }, } // keep a tally of which urls got opened @@ -116,7 +116,7 @@ const openUrl = (url, errMsg, cb) => { const repo = requireInject('../../lib/repo.js', { pacote, - '../../lib/utils/open-url.js': openUrl + '../../lib/utils/open-url.js': openUrl, }) t.test('completion', t => { @@ -152,7 +152,7 @@ t.test('open repo urls', t => { unhostedgithttpobj: 'http://gothib.com/foo/unhostedgithttpobj', unhostedgithttpsobj: 'https://gothib.com/foo/unhostedgithttpsobj', directory: 'https://github.com/foo/test-repo-with-directory/tree/master/some/directory', - '.': 'https://example.com/thispkg' + '.': 'https://example.com/thispkg', } const keys = Object.keys(expect) t.plan(keys.length) @@ -174,7 +174,7 @@ t.test('fail if cannot figure out repo url', t => { 'norepo', 'repoobbj-nourl', 'unhostedgitat', - 'unhostedgitatobj' + 'unhostedgitatobj', ] t.plan(cases.length) |