var Application = require('spectron').Application;
var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
var electron = require('electron-prebuilt');

global.before(function () {
    chai.should()
    chai.use(chaiAsPromised)
});

beforeEach(function () {
    this.app = new Application({
        path: electron,
        args: ['electron-app']
    });
    return this.app.start()
});

beforeEach(function () {
    chaiAsPromised.transferPromiseness = this.app.transferPromiseness
});

afterEach(function () {
    if (this.app && this.app.isRunning()) {
        return this.app.stop()
    }
});
@@ -396,32 +396,21 @@
 .start()
-%0A%7D);%0A%0AbeforeEach
+.then
 (functio
@@ -404,36 +404,43 @@
 .then(function (
+app
 ) %7B%0A
+    
     chaiAsPromis
@@ -464,21 +464,16 @@
 eness = 
-this.
 app.tran
@@ -487,16 +487,43 @@
 miseness
+;%0A        return app%0A    %7D)
 %0A%7D);%0A%0Aaf

consolidate before each into one