I've setup a bare test case with WebdriverIO and SauceConnect in this repo https://github.com/gkostov/wdio-test but when running it it fails with
{
"message": "Uncaught SyntaxError: Unexpected reserved word",
"filename": "http://192.168.1.51:61964/@wdio/browser-runner/setup",
"error": "SyntaxError: Unexpected reserved word"
}
Here are the execution logs https://app.eu-central-1.saucelabs.com/tests/f48c163a8fca4f80b6eb92c17065039c
These are package.json
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"@wdio/browser-runner": "^8.11.2",
"@wdio/cli": "^8.11.2",
"@wdio/sauce-service": "^8.11.2",
"webdriverio": "^8.11.2"
}
}
and wdio.conf.js
module.exports.config = {
// ...
runner: 'browser',
specs: ['./test/index.js'],
user: process.env.SAUCE_USERNAME,
key: process.env.SAUCE_ACCESS_KEY,
region: 'eu',
services: [
['sauce', {
sauceConnect: true,
sauceConnectOpts: {
// ...
}
}]
],
capabilities: [{
browserName: 'chrome',
platformName: 'Windows 10',
browserVersion: '75'
}],
logLevel: 'trace',
};
I'm running it with
# > SAUCE_USERNAME=my_name SAUCE_ACCESS_KEY=my_key npx wdio
There is no code in the test file - I've been removing lines from there (assuming I've been doing something wrong like unsupported syntax, etc.) until I realised that my test code didn't get to even execute. Which is why I set up that test repo to try a minimal case that is still showing the error.
At some point I thought it may be because I'm using the latest webdriverio so it may need to run a in "module" type of project. So I added "type": "module" to package.json, converted the wdio.conf.js to ES6. But it failed with the exact same error.
I've tried looking up examples but only found ones using versions before 8 (and there have been significant changes in 8).