diff --git a/src/__tests__/config.js b/src/__tests__/config.js index 7fdb1e00..698d7aaf 100644 --- a/src/__tests__/config.js +++ b/src/__tests__/config.js @@ -56,6 +56,14 @@ describe('configuration API', () => { }) }) + test('configuring only DTL options preserves previously set RTL options', () => { + configure({reactStrictMode: true}) + configure({testIdAttribute: 'not-data-testid'}) + + expect(getConfig().reactStrictMode).toBe(true) + expect(getConfig().testIdAttribute).toBe('not-data-testid') + }) + test('configure can set DTL and RTL options at once', () => { const testIdAttribute = 'not-data-testid' configure({testIdAttribute, reactStrictMode: true}) diff --git a/src/config.js b/src/config.js index dc8a5035..4a5c0ada 100644 --- a/src/config.js +++ b/src/config.js @@ -25,9 +25,11 @@ function configure(newConfig) { configureDTL(configForDTL) - configForRTL = { - ...configForRTL, - reactStrictMode, + if (reactStrictMode !== undefined) { + configForRTL = { + ...configForRTL, + reactStrictMode, + } } }