feat(config): add workspaces boolean to user-agent · npm/cli@59171f0 (original) (raw)
`@@ -729,7 +729,7 @@ t.test('user-agent', t => {
`
729
729
`}
`
730
730
`const flat = {}
`
731
731
`` const expectNoCI = npm/1.2.3 node/9.8.7 +
``
732
``
`` -
${process.platform} ${process.arch}
``
``
732
`` +
${process.platform} ${process.arch} workspaces/false
``
733
733
`definitions['user-agent'].flatten('user-agent', obj, flat)
`
734
734
`t.equal(flat.userAgent, expectNoCI)
`
735
735
`t.equal(process.env.npm_config_user_agent, flat.userAgent, 'npm_user_config environment is set')
`
`@@ -742,6 +742,23 @@ t.test('user-agent', t => {
`
742
742
`t.equal(flat.userAgent, expectCI)
`
743
743
`t.equal(process.env.npm_config_user_agent, flat.userAgent, 'npm_user_config environment is set')
`
744
744
`t.equal(obj['user-agent'], flat.userAgent, 'config user-agent template is translated')
`
``
745
+
``
746
`+
delete obj['ci-name']
`
``
747
`+
obj.workspaces = true
`
``
748
`+
obj['user-agent'] = definitions['user-agent'].default
`
``
749
`+
const expectWorkspaces = expectNoCI.replace('workspaces/false', 'workspaces/true')
`
``
750
`+
definitions['user-agent'].flatten('user-agent', obj, flat)
`
``
751
`+
t.equal(flat.userAgent, expectWorkspaces)
`
``
752
`+
t.equal(process.env.npm_config_user_agent, flat.userAgent, 'npm_user_config environment is set')
`
``
753
`+
t.equal(obj['user-agent'], flat.userAgent, 'config user-agent template is translated')
`
``
754
+
``
755
`+
delete obj.workspaces
`
``
756
`+
obj.workspace = ['foo']
`
``
757
`+
obj['user-agent'] = definitions['user-agent'].default
`
``
758
`+
definitions['user-agent'].flatten('user-agent', obj, flat)
`
``
759
`+
t.equal(flat.userAgent, expectWorkspaces)
`
``
760
`+
t.equal(process.env.npm_config_user_agent, flat.userAgent, 'npm_user_config environment is set')
`
``
761
`+
t.equal(obj['user-agent'], flat.userAgent, 'config user-agent template is translated')
`
745
762
`t.end()
`
746
763
`})
`
747
764
``