Closed aeneasr closed 7 years ago
Ok, I got one step further by doing const electron = path.resolve(__dirname, '../../../node_modules/.bin/electron')
(which works due to electron-prebuilt-compile
) but now yields:
got it:
const Application = require('spectron').Application
const path = require('path')
const electron = path.resolve(__dirname, '../../../node_modules/.bin/electron')
const exec = require('child_process').exec
jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000
describe('tests/integration/app', () => {
let app
beforeEach(() => new Promise((resolve, reject) => {
exec(`${path.resolve(__dirname, '../../../node_modules/.bin/electron-compile')} ${path.join(__dirname, '../../../')}`, () => {
app = new Application({
path: electron,
args: [path.join(__dirname, '../../../src/main/index.js')]
})
app.start().then(resolve)
})
}))
afterEach(() => {
if (app && app.isRunning()) {
return app.stop()
}
})
it('opens a window', () => {
return app.client.waitUntilWindowLoaded()
})
})
My application uses es6 like import statements and I want to write integration tests. My set up currently looks like this:
I've also tried
const electron = require('electron-compile')
but that yieldsApplication path must be a string
.I couldn't find any docs on this and help is greatly appreciated!
ps: I'm using
electron-prebuilt-compile
in the app itself