Skip to content

Commit dd01891

Browse files
authored
Merge pull request #5 from mattonem/timeout
remove hardcoded timeout
2 parents b3f0ede + 47dd3e4 commit dd01891

3 files changed

Lines changed: 27 additions & 4 deletions

File tree

browserstack-mocha-export.mjs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,33 @@ function beforeEach() {
4141

4242
codeExport.opts.hooks.beforeEach = new exporter.hook(beforeEach())
4343

44+
function declareVariables() {
45+
const params = {
46+
startingSyntax: {
47+
commands: [
48+
{
49+
level: 0,
50+
statement: `this.timeout(process.env.testTimeout)`,
51+
},
52+
{
53+
level: 0,
54+
statement: `let driver`,
55+
},
56+
{
57+
level: 0,
58+
statement: 'let vars',
59+
},
60+
],
61+
},
62+
}
63+
return params
64+
}
65+
66+
codeExport.opts.hooks.declareVariables = new exporter.hook(declareVariables())
67+
4468
function generateTestDeclaration(name) {
4569
return `it('test', async function() {`
4670
}
4771

4872
codeExport.opts.generateTestDeclaration = generateTestDeclaration
49-
5073
export default codeExport

index.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ commander
1818
.option('-d, --debug', 'output extra debugging')
1919
.option('-f, --filter <grep regex>', 'Run tests matching name')
2020
.option('--base-url <url>', 'Override the base URL that was set in the IDE')
21-
.option('--test-timeout <ms>', 'Timeout value for each tests. (default: 30000)')
21+
.option('--test-timeout <ms>', 'Timeout value for each tests (default: 30000)')
2222
.option('--browserstack.config <path>','path to browserstack config file, default to browserstack.yml')
2323
.option('--output-format <json|xunit>', 'Format for the output file.')
2424
.option('--output-file <path>','path for the report file. required if --output-format provided')
@@ -91,7 +91,7 @@ var reporter = []
9191
if(options.outputFormat && options.outputFile)
9292
reporter = [ '--reporter', options.outputFormat, '--reporter-options', 'output=' + options.outputFile]
9393

94-
const testSuiteProcess = spawn.sync('npx', ['browserstack-node-sdk', 'mocha', '_generated', '--timeout', options.testTimeout, '-g', options.filter, '--browserstack.config', options.browserstackConfig, ...reporter], { stdio: 'inherit' });
94+
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 } });
9595

9696
if(!options.debug)
9797
{

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "git",
55
"url": "git+https://github.com/mattonem/browserstack-side-runner.git"
66
},
7-
"version": "2.0.0-beta.12",
7+
"version": "2.0.0-beta.13",
88
"main": "index.mjs",
99
"homepage": "https://github.com/mattonem/browserstack-side-runner#readme",
1010
"scripts": {

0 commit comments

Comments
 (0)