Skip to content

Instantly share code, notes, and snippets.

@Momotoculteur
Last active February 9, 2020 16:18
Show Gist options
  • Save Momotoculteur/e3f045831bdbcb5e183e4801a7db0f00 to your computer and use it in GitHub Desktop.
Save Momotoculteur/e3f045831bdbcb5e183e4801a7db0f00 to your computer and use it in GitHub Desktop.
basic template for Electron with Jest and Spectron
// 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