Vue-instantsearch: nuxt jest unexpected token export

Created on 14 Jan 2021  ยท  2Comments  ยท  Source: algolia/vue-instantsearch

Bug ๐Ÿž

What is the current behavior?

on yarn test jest runner throws error when importing instantsearch

/Users/kai/dev/nuxt-jest-instantsearch/node_modules/instantsearch.js/es/lib/routers/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){export { default as history } from './history';
                                                                                         ^^^^^^

SyntaxError: Unexpected token 'export'

 import { history as historyRouter } from 'instantsearch.js/es/lib/routers'

Make a sandbox with the current behavior

a minimal repo can be found here nuxt-jest-instantsearch
the import to instantsearch is instantsearch.spec.js

the transformIgnorePatterns fix from #588 is already applied to jest.config.js

What is the expected behavior?

no error Syntaxerror should occur

Does this happen only in specific situations?

on running jest

What is the version you are using?

โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ instantsearch.js@^4.7.0

Most helpful comment

@eunjae-lee that fixed it, thanks so much!

All 2 comments

Hello @toyflish
It seems like you need to convert your .babelrc to babel.config.js.
https://github.com/facebook/jest/issues/10256

@eunjae-lee that fixed it, thanks so much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alekcarvalho picture alekcarvalho  ยท  3Comments

bobylito picture bobylito  ยท  4Comments

francoischalifour picture francoischalifour  ยท  3Comments

VinceG picture VinceG  ยท  6Comments

abattenburg picture abattenburg  ยท  4Comments