From 62d9922cfd1944336ff4a0e64579503f246e43f4 Mon Sep 17 00:00:00 2001 From: Alexey Padalko Date: Thu, 10 Oct 2019 21:02:37 +0300 Subject: [PATCH] test(e2e): use mock keytar when running e2e on linux --- test/unit/__mocks__/keytar.js | 2 +- webpack/webpack.config.e2e.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/test/unit/__mocks__/keytar.js b/test/unit/__mocks__/keytar.js index a0d6167a97e..47d75df35ac 100644 --- a/test/unit/__mocks__/keytar.js +++ b/test/unit/__mocks__/keytar.js @@ -3,7 +3,7 @@ import set from 'lodash/set' const db = {} -module.exports = { +export default { setPassword(service, account, password) { set(db, [service, account], password) return Promise.resolve() diff --git a/webpack/webpack.config.e2e.js b/webpack/webpack.config.e2e.js index 743491d7084..c4f75fe2784 100644 --- a/webpack/webpack.config.e2e.js +++ b/webpack/webpack.config.e2e.js @@ -2,12 +2,19 @@ * Webpack config for use with testcafe (e2e). */ +import path from 'path' +import os from 'os' import prodConfig from './webpack.config.prod' // Disable minification for compatibility with testcafe-react-selectors. prodConfig.map(config => { config.optimization.minimizer = [] + return config }) +// patch mainConfig. use mock keytar on linux +if (os.platform() === 'linux') { + prodConfig[2].resolve.alias['keytar'] = path.resolve(__dirname, '../test/unit/__mocks__/keytar') +} export default prodConfig