Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: move to @nuxtjs/i18n #221

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

Conversation

divine
Copy link

@divine divine commented Aug 30, 2021

No description provided.

@divine
Copy link
Author

divine commented Aug 31, 2021

This is kinda important and urgent change after the major release of @nuxtjs/i18n since it's being used together mostly.

Tests are failing on CircleCI and I can't see why? Maybe move to Github actions?

Any help is needed with maintaining this module?

Thanks!

@NicoPennec NicoPennec self-requested a review August 31, 2021 20:37
@NicoPennec
Copy link
Member

Hi @divine, I'm reviewing it and i will check your CI error.

@NicoPennec
Copy link
Member

NicoPennec commented Aug 31, 2021

@divine the test failed due to the new release of @nuxtjs/i18n which does not appear as a CommonJS compliant module (see the Jest error below).

I have to check how to configure Jest to run correctly your ESM module.

FYI, you can run the unit tests locally for more details with the yarn test command. A githook should have done this before accept your commit 🤔


  ● sitemap - advanced configuration › i18n options › encountered a declaration exception

    Jest encountered an unexpected token

    This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

    By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".

    Here's what you can do:
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/en/configuration.html

    Details:

    /.../sitemap-module/node_modules/@nuxtjs/i18n/src/index.js:1
    import { resolve, join } from 'path'
    ^^^^^^

    SyntaxError: Cannot use import statement outside a module

      336 | 
      337 |   describe('i18n options', () => {
    > 338 |     const modules = [require('@nuxtjs/i18n'), require('..')]
          |                      ^
      339 | 
      340 |     const nuxtI18nConfig = {
      341 |       locales: ['en', 'fr'],

      at Runtime._execModule (node_modules/jest-runtime/build/index.js:1179:56)
      at Suite.<anonymous> (test/module.test.js:338:22)
      at Suite.<anonymous> (test/module.test.js:337:3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants