diff --git a/packages/enzyme-test-suite/test/Adapter-spec.jsx b/packages/enzyme-test-suite/test/Adapter-spec.jsx index 18dd84153..38097e117 100644 --- a/packages/enzyme-test-suite/test/Adapter-spec.jsx +++ b/packages/enzyme-test-suite/test/Adapter-spec.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { expect } from 'chai'; import jsdom from 'jsdom'; -import configuration from 'enzyme/build/configuration'; +import { get } from 'enzyme/build/configuration'; import { configure, shallow } from 'enzyme'; import './_helpers/setupAdapters'; @@ -10,7 +10,7 @@ import { renderToString } from './_helpers/react-compat'; import { REACT013, REACT16 } from './_helpers/version'; import { itIf, describeWithDOM } from './_helpers'; -const { adapter } = configuration.get(); +const { adapter } = get(); const prettyFormat = o => JSON.stringify(o, null, 2); diff --git a/packages/enzyme-test-suite/test/Debug-spec.jsx b/packages/enzyme-test-suite/test/Debug-spec.jsx index f665bc5a2..0d8518529 100644 --- a/packages/enzyme-test-suite/test/Debug-spec.jsx +++ b/packages/enzyme-test-suite/test/Debug-spec.jsx @@ -1,7 +1,7 @@ import { expect } from 'chai'; import React from 'react'; import { mount, shallow } from 'enzyme'; -import configuration from 'enzyme/build/configuration'; +import { get } from 'enzyme/build/configuration'; import { spaces, indent, @@ -17,7 +17,7 @@ import { } from './_helpers'; import { REACT013 } from './_helpers/version'; -const { adapter } = configuration.get(); +const { adapter } = get(); const debugElement = element => debugNode(adapter.elementToNode(element)); diff --git a/packages/enzyme/src/Utils.js b/packages/enzyme/src/Utils.js index bc7d49cf8..0cc7e6280 100644 --- a/packages/enzyme/src/Utils.js +++ b/packages/enzyme/src/Utils.js @@ -6,7 +6,7 @@ import functionName from 'function.prototype.name'; import has from 'has'; import flat from 'array.prototype.flat'; -import configuration from './configuration'; +import { get } from './configuration'; import validateAdapter from './validateAdapter'; import { childrenOfNode } from './RSTTraversal'; @@ -17,7 +17,7 @@ export function getAdapter(options = {}) { validateAdapter(options.adapter); return options.adapter; } - const { adapter } = configuration.get(); + const { adapter } = get(); validateAdapter(adapter); return adapter; } @@ -39,7 +39,7 @@ export function makeOptions(options) { }; return { - ...configuration.get(), + ...get(), ...options, ...mountTargets, }; diff --git a/packages/enzyme/src/configuration.js b/packages/enzyme/src/configuration.js index 755c39504..cd460666c 100644 --- a/packages/enzyme/src/configuration.js +++ b/packages/enzyme/src/configuration.js @@ -2,12 +2,13 @@ import validateAdapter from './validateAdapter'; const configuration = {}; -module.exports = { - get() { return { ...configuration }; }, - merge(extra) { - if (extra.adapter) { - validateAdapter(extra.adapter); - } - Object.assign(configuration, extra); - }, -}; +export function get() { + return { ...configuration }; +} + +export function merge(extra) { + if (extra.adapter) { + validateAdapter(extra.adapter); + } + Object.assign(configuration, extra); +}