Last active
February 9, 2020 16:18
-
-
Save Momotoculteur/e3f045831bdbcb5e183e4801a7db0f00 to your computer and use it in GitHub Desktop.
basic template for Electron with Jest and Spectron
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IMPORT | |
const assert = require('assert'); | |
const path = require('path'); | |
const Application = require('spectron').Application; | |
const electronPath = require('electron'); | |
// Définition d'un fichier de test | |
describe('Description du fichier', function () { | |
// Time out | |
jest.setTimeout(10000) | |
// Définition de notre application à tester | |
const app = new Application({ | |
path: electronPath, | |
args: [path.join(__dirname, '../..')], | |
startTimeout: 10000, | |
waitTimeout: 10000 | |
}); | |
// Appelé avant chaque test | |
beforeEach(() => { | |
return app.start(); | |
}); | |
// Appelé après chaque test | |
afterEach(() => { | |
if (app && app.isRunning()) { | |
return app.stop(); | |
} | |
}); | |
// Définition d'un test | |
it('Description du test', () => { | |
// C'est ICI que vous réalisez votre test | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment