Tuesday 30 May 2017

Spectron testing producing a JScript syntax error

I'm trying to test out spectron for electron in terms of testing but as I'm going through a tutorial, I keep getting this error message whenever I run npm run test:e2e. My test file syntactically correct but im not sure why i run into an error through compilation

Specs:

  • Nodejs 6.10.3

  • Electron 1.6.1

here's the error message

here's the json file package.json

{
  "name": "your-app",
  "version": "0.1.0",
  "main": "main.js",
  "scripts": {
    "start": "C:/Users/Livs/Documents/imdc/logger/node_modules/.bin/electron .",
    "test:e2e": "C:/Users/Livs/Documents/imdc/logger/test.js"
  },
  "devDependencies": {
    "electron-chromedriver": "^1.7.1",
    "electron-prebuilt": "^1.4.13",
    "electron-rebuild": "^1.5.11",
    "chai": "^3.5.0",
    "chai-as-promised": "^5.3.0",
    "electron": "^1.3.4",
    "mocha": "^3.0.2",
    "spectron": "^3.4.0"
  }
}

Heres the testing file test.js

const Application = require('spectron').Application;
const path = require('path');
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');

var electronPath = path.join(__dirname, '..', 'node_modules', '.bin',     'electron');

if (process.platform === 'win32') {
    electronPath += '.cmd';
}

var appPath = path.join(__dirname, '..');

var app = new Application({
            path: electronPath,
            args: [appPath]
        });



via Livius

No comments:

Post a Comment