Skip to content

Commit

Permalink
Merge branch 'master' into fix_o11y_timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanbs authored Jul 23, 2024
2 parents af0b361 + 42a6b2c commit be56249
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions bin/helpers/packageInstaller.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
{ get_version } = require('./usageReporting'),
process = require('process'),
{ spawn } = require('child_process'),
cliUtils = require("./utils"),
util = require('util');

let nodeProcess;
Expand Down Expand Up @@ -58,7 +59,7 @@ const setupPackageFolder = (runSettings, directoryPath) => {
})
};

const packageInstall = (packageDir) => {
const packageInstall = (packageDir, bsConfig) => {
return new Promise(function (resolve, reject) {
const nodeProcessCloseCallback = (code) => {
if(code == 0) {
Expand All @@ -74,6 +75,16 @@ const packageInstall = (packageDir) => {
reject(`Packages were not installed successfully. Error Description ${util.format('%j', error)}`);
};

// Moving .npmrc to tmpBstackPackages
try {
logger.debug(`Copying .npmrc file to temporary package directory`);
const npmrcRootPath = path.join(cliUtils.isNotUndefined(bsConfig.run_settings.home_directory) ? path.resolve(bsConfig.run_settings.home_directory) : './', '.npmrc');
const npmrcTmpPath = path.join(path.resolve(packageDir), '.npmrc');
fs.copyFileSync(npmrcRootPath, npmrcTmpPath);
} catch (error) {
logger.debug(`Failed copying .npmrc to ${packageDir}: ${error}`)
}

let nodeProcess;
logger.debug(`Fetching npm version and its major version`);
const npm_version = get_version('npm')
Expand Down Expand Up @@ -147,7 +158,7 @@ const packageSetupAndInstaller = (bsConfig, packageDir, instrumentBlocks) => {
instrumentBlocks.markBlockEnd("packageInstaller.folderSetup");
instrumentBlocks.markBlockStart("packageInstaller.packageInstall");
logger.debug("Started installing dependencies specified in browserstack.json");
return packageInstall(packageDir);
return packageInstall(packageDir, bsConfig);
}).then((_result) => {
logger.debug("Completed installing dependencies");
instrumentBlocks.markBlockEnd("packageInstaller.packageInstall");
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "browserstack-cypress-cli",
"version": "1.31.2",
"version": "1.31.3",
"description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit be56249

Please sign in to comment.