diff options
Diffstat (limited to 'deps/npm/test/lib/publish.js')
-rw-r--r-- | deps/npm/test/lib/publish.js | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/deps/npm/test/lib/publish.js b/deps/npm/test/lib/publish.js index 6e0075835c..df73b6863b 100644 --- a/deps/npm/test/lib/publish.js +++ b/deps/npm/test/lib/publish.js @@ -9,14 +9,10 @@ const fs = require('fs') const log = require('npmlog') log.level = 'silent' -const cleanGithead = (result) => { - return result.map((r) => { - if (r.gitHead) - r.gitHead = '{GITHEAD}' - - return r - }) +t.cleanSnapshot = (data) => { + return data.replace(/^ *"gitHead": .*$\n/gm, '') } + const {definitions} = require('../../lib/utils/config') const defaults = Object.entries(definitions).reduce((defaults, [key, def]) => { defaults[key] = def.default @@ -589,7 +585,7 @@ t.test('workspaces', (t) => { log.level = 'info' publish.execWorkspaces([], [], (err) => { t.notOk(err) - t.matchSnapshot(cleanGithead(publishes), 'should publish all workspaces') + t.matchSnapshot(publishes, 'should publish all workspaces') t.matchSnapshot(outputs, 'should output all publishes') t.end() }) @@ -599,7 +595,7 @@ t.test('workspaces', (t) => { log.level = 'info' publish.execWorkspaces([], ['workspace-a'], (err) => { t.notOk(err) - t.matchSnapshot(cleanGithead(publishes), 'should publish given workspace') + t.matchSnapshot(publishes, 'should publish given workspace') t.matchSnapshot(outputs, 'should output one publish') t.end() }) @@ -618,7 +614,7 @@ t.test('workspaces', (t) => { npm.config.set('json', true) publish.execWorkspaces([], [], (err) => { t.notOk(err) - t.matchSnapshot(cleanGithead(publishes), 'should publish all workspaces') + t.matchSnapshot(publishes, 'should publish all workspaces') t.matchSnapshot(outputs, 'should output all publishes as json') t.end() }) @@ -707,7 +703,7 @@ t.test('private workspaces', (t) => { npm.color = true publish.execWorkspaces([], [], (err) => { t.notOk(err) - t.matchSnapshot(cleanGithead(publishes), 'should publish all non-private workspaces') + t.matchSnapshot(publishes, 'should publish all non-private workspaces') t.matchSnapshot(outputs, 'should output all publishes') npm.color = false t.end() @@ -734,7 +730,7 @@ t.test('private workspaces', (t) => { publish.execWorkspaces([], [], (err) => { t.notOk(err) - t.matchSnapshot(cleanGithead(publishes), 'should publish all non-private workspaces') + t.matchSnapshot(publishes, 'should publish all non-private workspaces') t.matchSnapshot(outputs, 'should output all publishes') t.end() }) |