Open divine opened 3 years ago
Hi @divine, I'm reviewing it and i will check your CI error.
@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 :thinking:
● 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)
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!