From 404036a56c4b7f4c46711e44d2897c1802f65039 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 | 8 ++++++++ 2 files changed, 9 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..b143d6fec8a 100644 --- a/webpack/webpack.config.e2e.js +++ b/webpack/webpack.config.e2e.js @@ -2,12 +2,20 @@ * 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 +// TODO remove and add support for linux in e2e +if (os.platform() === 'linux') { + prodConfig[2].resolve.alias['keytar'] = path.resolve(__dirname, '../test/unit/__mocks__/keytar') +} export default prodConfig