File size: 631 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import {
  getConfig as getConfigDTL,
  configure as configureDTL,
} from '@testing-library/dom'

let configForRTL = {
  reactStrictMode: false,
}

function getConfig() {
  return {
    ...getConfigDTL(),
    ...configForRTL,
  }
}

function configure(newConfig) {
  if (typeof newConfig === 'function') {
    // Pass the existing config out to the provided function
    // and accept a delta in return
    newConfig = newConfig(getConfig())
  }

  const {reactStrictMode, ...configForDTL} = newConfig

  configureDTL(configForDTL)

  configForRTL = {
    ...configForRTL,
    reactStrictMode,
  }
}

export {getConfig, configure}