Skip to content

Commit b290ddc

Browse files
authored
Merge pull request #6 from BrowserStackCE/eso-fix
Fixing ES issues and dependencies Ensured compatibility with node 18.20
2 parents 43b08ad + eef715d commit b290ddc

File tree

3 files changed

+27
-11
lines changed

3 files changed

+27
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
22
package-lock.json
33
semgrep.sarif
4+
.DS_Store

index.mjs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
#!/usr/bin/env node
22

33
import fs from 'fs'
4-
import rimraf from "rimraf";
4+
import { rimrafSync } from "rimraf";
55
import path from 'path'
66
import codeExport from './browserstack-mocha-export.mjs'
77
import { project as projectProcessor } from '@seleniumhq/side-code-export'
88
import pkg from '@seleniumhq/side-utils';
99
import commander from 'commander';
1010
import logger from 'cli-logger';
11-
import glob from 'glob';
11+
import { globSync } from 'glob';
1212
import spawn from 'cross-spawn';
1313
import * as dotenv from 'dotenv';
1414
import { exit } from 'process';
1515
import sanitize from 'sanitize-filename';
16+
import { fileURLToPath } from 'url';
1617

1718
dotenv.config();
1819
commander
@@ -36,14 +37,14 @@ var log = logger(conf);
3637

3738
const sideFiles = [
3839
...commander.args.reduce((projects, project) => {
39-
glob.sync(project).forEach(p => {
40+
globSync(project).forEach(p => {
4041
projects.add(p)
4142
})
4243
return projects
4344
}, new Set()),
4445
];
4546

46-
rimraf.sync(options.buildFolderPath)
47+
rimrafSync(options.buildFolderPath)
4748
fs.mkdirSync(options.buildFolderPath);
4849

4950
function readFile(filename) {
@@ -90,9 +91,20 @@ var reporter = []
9091
if (options.outputFormat && options.outputFile)
9192
reporter = ['--reporter', options.outputFormat, '--reporter-options', 'output=' + options.outputFile]
9293

93-
const testSuiteProcess = spawn.sync('npx', ['browserstack-node-sdk', 'mocha', '_generated', '--timeouts', options.testTimeout, '-g', options.filter, '--browserstack.config', options.browserstackConfig, ...reporter], { stdio: 'inherit', env: { ...process.env, testTimeout: options.testTimeout } });
94+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
95+
const browserstackSdkPath = path.join(__dirname, 'node_modules', '.bin', 'browserstack-node-sdk');
96+
const sideRunnerNodeModules = path.join(__dirname, 'node_modules');
97+
98+
const testSuiteProcess = spawn.sync(browserstackSdkPath, ['mocha', '_generated', '--timeouts', options.testTimeout, '-g', options.filter, '--browserstack.config', options.browserstackConfig, ...reporter], {
99+
stdio: 'inherit',
100+
env: {
101+
...process.env,
102+
testTimeout: options.testTimeout,
103+
NODE_PATH: `${sideRunnerNodeModules}${path.delimiter}${process.env.NODE_PATH || ''}`
104+
}
105+
});
94106

95107
if (!options.debug) {
96-
rimraf.sync(options.buildFolderPath)
108+
rimrafSync(options.buildFolderPath)
97109
}
98110
exit(testSuiteProcess.status)

package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "git",
55
"url": "git+https://github.com/BrowserStackCE/browserstack-side-runner.git"
66
},
7-
"version": "2.2.2",
7+
"version": "2.3.0",
88
"main": "index.mjs",
99
"homepage": "https://github.com/BrowserStackCE/browserstack-side-runner#readme",
1010
"scripts": {
@@ -13,6 +13,9 @@
1313
"bin": {
1414
"browserstack-side-runner": "index.mjs"
1515
},
16+
"engines": {
17+
"node": ">=18"
18+
},
1619
"author": "",
1720
"license": "ISC",
1821
"description": "",
@@ -21,18 +24,18 @@
2124
"@seleniumhq/code-export-javascript-mocha": "^4.0.0-alpha.4",
2225
"@seleniumhq/side-code-export": "^4.0.0-alpha.3",
2326
"@seleniumhq/side-utils": "^3.17.2",
24-
"browserstack-node-sdk": "^1.32.0",
27+
"browserstack-node-sdk": "^1.40.8",
2528
"cli-logger": "^0.5.40",
2629
"commander": "^8.0.0",
2730
"cross-spawn": "^7.0.3",
2831
"dotenv": "^16.0.3",
29-
"glob": "^11.0.3",
32+
"glob": "^10.4.5",
3033
"js-yaml": "^4.1.0",
3134
"mocha": "^8.4.0",
3235
"mocha-multi-reporters": "^1.5.1",
3336
"rfdc": "^1.3.0",
34-
"rimraf": "^6.0.1",
37+
"rimraf": "^5.0.9",
3538
"sanitize-filename": "^1.6.3",
36-
"selenium-webdriver": "^4.1.1"
39+
"selenium-webdriver": "^4.5.0"
3740
}
3841
}

0 commit comments

Comments
 (0)