oblador / loki

👁 Visual Regression Testing for Storybook

Home Page:https://loki.js.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed to load locales or server is down

mr-scrpt opened this issue · comments

Hi, I have updated the project packages to the latest versions and after that loki stopped working
When i run yarn loki test i get the error
1 request failed to load; http://192.168.1.106:6006/locales/en-US/translation.json
But I don't have that path in my project and I don't understand where it gets it from, here is the actual path for translations (not en-US, just en)
http://localhost:6006/locales/en/translation.json
The dev server of the storybook is working correctly
So I also tried running a check on the static build of the storybook
yarn loki --requireReference --reactUri file:./storybook-static
I'm getting an error

Failed fetching stories because the server is down
       Try starting it with "yarn storybook" or pass the --port or --host arguments if it's not running at http://192.168.1.106:30528

But this command doesn't need a storybook server at all, because I'm checking static files in the folder

The wrong i18n config file was connected for the storybook - when I connected the right one, the first problem disappeared. Then I made some edits to the i18n config and it solved the second problem, here is how my config looks like

import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'

import Backend from 'i18next-http-backend'
import LanguageDetector from 'i18next-browser-languagedetector'

i18n
  .use(Backend)
  .use(LanguageDetector)
  .use(initReactI18next)
  .init({
    // lng: 'en',
    fallbackLng: 'en',
    // debug: __IS_DEV__,
    debug: true,
    load: 'languageOnly',

    interpolation: {
      escapeValue: false, // not needed for react as it escapes by default
    },
    backend: {
      loadPath: '/locales/{{lng}}/{{ns}}.json',
    },
    keySeparator: false,
  })

export default i18n