Move getClientConfig setup to tests/setup
This commit is contained in:
Родитель
bce3361b2c
Коммит
4caa35aa2b
|
@ -1,17 +1,3 @@
|
||||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
||||||
require('babel-register');
|
|
||||||
|
|
||||||
const config = require('config');
|
|
||||||
|
|
||||||
function getClientConfig(_config) {
|
|
||||||
const clientConfig = {};
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
for (const key of _config.get('clientConfigKeys')) {
|
|
||||||
clientConfig[key] = _config.get(key);
|
|
||||||
}
|
|
||||||
return clientConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
coveragePathIgnorePatterns: [
|
coveragePathIgnorePatterns: [
|
||||||
'<rootDir>/node_modules/',
|
'<rootDir>/node_modules/',
|
||||||
|
@ -19,9 +5,6 @@ module.exports = {
|
||||||
'<rootDir>/tests/',
|
'<rootDir>/tests/',
|
||||||
'<rootDir>/config/',
|
'<rootDir>/config/',
|
||||||
],
|
],
|
||||||
globals: {
|
|
||||||
CLIENT_CONFIG: getClientConfig(config),
|
|
||||||
},
|
|
||||||
moduleDirectories: [
|
moduleDirectories: [
|
||||||
'src',
|
'src',
|
||||||
'node_modules',
|
'node_modules',
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import 'babel-polyfill';
|
import 'babel-polyfill';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
|
import config from 'config';
|
||||||
import areIntlLocalesSupported from 'intl-locales-supported';
|
import areIntlLocalesSupported from 'intl-locales-supported';
|
||||||
|
|
||||||
class LocalStorageMock {
|
class LocalStorageMock {
|
||||||
|
@ -67,6 +68,8 @@ global.sinon = realSinon.sandbox.create();
|
||||||
global.sinon.createStubInstance = realSinon.createStubInstance;
|
global.sinon.createStubInstance = realSinon.createStubInstance;
|
||||||
global.sinon.format = realSinon.format;
|
global.sinon.format = realSinon.format;
|
||||||
global.sinon.assert = realSinon.assert;
|
global.sinon.assert = realSinon.assert;
|
||||||
|
// Stub the magic constant webpack normally supplies.
|
||||||
|
global.CLIENT_CONFIG = require('core/utils').getClientConfig(config);
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
global.sinon.restore();
|
global.sinon.restore();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче