config.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import deepmerge from 'deepmerge'
  2. import { buildConfig } from '@/functions'
  3. const getMixinConfig = () => import('@/mixins/ExperimentBase/config')
  4. const getGlobalConfig = () => import('@/../experimentConfig/mixins/ExperimentBaseAreSameImages')
  5. // This will apply to all the scenes
  6. export const defaultConfig = async () => {
  7. // Import parent mixin config
  8. const mixinConfig = await getMixinConfig().then(({ defaultConfig: fn }) => fn())
  9. // Import global config
  10. const globalConfig = (await getGlobalConfig()).defaultConfig
  11. return deepmerge.all([
  12. mixinConfig,
  13. {
  14. maxTestCount: 5
  15. },
  16. globalConfig
  17. ])
  18. }
  19. // This will overwrite the config for the given scene
  20. export const scenesConfig = async () => {
  21. // Import parent mixin config
  22. const mixinConfig = await getMixinConfig().then(({ scenesConfig: fn }) => fn())
  23. // Import global config
  24. const globalConfig = (await getGlobalConfig()).scenesConfig
  25. return deepmerge.all([
  26. mixinConfig,
  27. {},
  28. globalConfig
  29. ])
  30. }
  31. export default async () => buildConfig(await defaultConfig(), await scenesConfig())