2019-09-15 22:49:40 -06:00
|
|
|
import Vue from 'vue';
|
|
|
|
|
|
|
|
const { getComputedStyle } = window;
|
|
|
|
|
|
|
|
Vue.config.productionTip = false;
|
|
|
|
|
|
|
|
// Prevents console log message to install Vue DevTools
|
|
|
|
Vue.config.devtools = false;
|
|
|
|
|
|
|
|
// Monkeypatch JSDOM missing transition styles + vue-test-utils not properly stubbing transitions
|
|
|
|
// in globally included libs (VeeValidate in our case)
|
|
|
|
// https://github.com/vuejs/vue-test-utils/issues/839#issuecomment-410474714
|
|
|
|
window.getComputedStyle = function getComputedStyleStub (el) {
|
|
|
|
return {
|
|
|
|
...getComputedStyle(el),
|
|
|
|
transitionDelay: '',
|
|
|
|
transitionDuration: '',
|
|
|
|
animationDelay: '',
|
|
|
|
animationDuration: ''
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
global.beforeEach(() => {
|
|
|
|
window.process = {
|
2020-01-19 06:04:38 -07:00
|
|
|
cwd: process.cwd,
|
2019-09-15 22:49:40 -06:00
|
|
|
env: {
|
|
|
|
NODE_ENV: 'development'
|
|
|
|
},
|
|
|
|
versions: {
|
2020-02-19 10:00:03 -07:00
|
|
|
chromium: '80.0.3987.116',
|
|
|
|
nw: '0.44.2',
|
2019-09-15 22:49:40 -06:00
|
|
|
'nw-flavor': 'sdk',
|
2020-02-19 10:00:03 -07:00
|
|
|
node: '13.8.0'
|
2019-09-15 22:49:40 -06:00
|
|
|
}
|
|
|
|
};
|
|
|
|
window.nw = {
|
2019-10-29 10:27:18 -06:00
|
|
|
require: jest.fn((module) => {
|
|
|
|
if (module === 'fs') {
|
|
|
|
return {
|
|
|
|
readdirSync: jest.fn(() => {
|
|
|
|
return ['example-file-1.ext', 'example-file-2.ext'];
|
|
|
|
})
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}),
|
2019-09-15 22:49:40 -06:00
|
|
|
Shell: {
|
|
|
|
openExternal: jest.fn()
|
|
|
|
},
|
|
|
|
Window: {
|
|
|
|
get: function () {
|
|
|
|
return {
|
|
|
|
showDevTools: jest.fn(),
|
|
|
|
closeDevTools: jest.fn()
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
global.afterEach(() => {
|
|
|
|
window.nw.Window.get().showDevTools.mockClear();
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Jest's setTimeout defaults to 5 seconds.
|
|
|
|
// Bump the timeout to 60 seconds.
|
|
|
|
jest.setTimeout(60 * 1000);
|