-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy path_sfOrgOpen.js
More file actions
34 lines (30 loc) · 1.01 KB
/
_sfOrgOpen.js
File metadata and controls
34 lines (30 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'use strict';
// Initialize required modules
const sfdx = require('sfdx-node/parallel');
/**
* @function _sfScratchOrgOpen
* @description Attempts to open the specified scratchOrg
*
* @param {Object} environmentDef Represents the already-validated environment details to use when performing the actions
* @returns {Promise} Returns the result of the SF org-open request
*/
module.exports = environmentDef => {
const openArguments = {
_rejectOnError: true
};
// Set the username to deploy to if it's defined
if (Object.prototype.hasOwnProperty.call(environmentDef, 'sfScratchOrgUsername')) {
openArguments.targetusername = environmentDef.sfScratchOrgUsername;
}
// Attempt to open to the scratchOrg
return sfdx.force.org.open(openArguments)
.then(result => {
return {
outputDisplay: {
orgId: result.orgId,
username: result.username
},
result
};
});
};