mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 04:25:31 +08:00
918fa0b6dd
[*] update babel [client-app] remove flow-typed [client-app] Move build/package.json to main package.json [client-app] remove spec_integration [client-app] fix babel support Add client-private-plugins package.json [client-app] add node_modules to global path for private-plugins Move client-sync dependencies to client-app root fix electron rebuild [*] moved to monorepo Summary: App now runs in monorepo Test Plan: npm test Reviewers: juan, mark, khamidou, halla, spang Differential Revision: https://phab.nylas.com/D3947
49 lines
1.5 KiB
JavaScript
49 lines
1.5 KiB
JavaScript
import pathwatcher from 'pathwatcher';
|
|
import ReactTestUtils from 'react-addons-test-utils';
|
|
import {TaskQueue} from 'nylas-exports'
|
|
import {destroyTestDatabase} from '../../internal_packages/client-sync/spec/helpers'
|
|
|
|
class MasterAfterEach {
|
|
setup(loadSettings, afterEach) {
|
|
const styleElementsToRestore = NylasEnv.styles.getSnapshot();
|
|
|
|
const self = this
|
|
afterEach(async function masterAfterEach() {
|
|
await destroyTestDatabase()
|
|
NylasEnv.packages.deactivatePackages();
|
|
NylasEnv.menu.template = [];
|
|
|
|
if (NylasEnv.state) {
|
|
delete NylasEnv.state.packageStates;
|
|
}
|
|
|
|
if (!window.debugContent) {
|
|
document.getElementById('jasmine-content').innerHTML = '';
|
|
}
|
|
ReactTestUtils.unmountAll();
|
|
|
|
jasmine.unspy(NylasEnv, 'saveSync');
|
|
self.ensureNoPathSubscriptions();
|
|
|
|
NylasEnv.styles.restoreSnapshot(styleElementsToRestore);
|
|
|
|
this.removeAllSpies();
|
|
if (TaskQueue._queue.length > 0) {
|
|
console.inspect(TaskQueue._queue)
|
|
TaskQueue._queue = []
|
|
throw new Error("Your test forgot to clean up the TaskQueue")
|
|
}
|
|
waits(0);
|
|
}); // yield to ui thread to make screen update more frequently
|
|
}
|
|
|
|
ensureNoPathSubscriptions() {
|
|
const watchedPaths = pathwatcher.getWatchedPaths();
|
|
pathwatcher.closeAllWatchers();
|
|
if (watchedPaths.length > 0) {
|
|
throw new Error(`Leaking subscriptions for paths: ${watchedPaths.join(", ")}`);
|
|
}
|
|
}
|
|
}
|
|
|
|
export default new MasterAfterEach()
|