Since the query-string package only supports ESM (ECMAScript Modules), it may not work correctly with Jest. This can result in an error message like SyntaxError: Cannot use import statement outside a module
when running tests.
Add the following code to the jest.config.js
file to fix this issue.
"transformIgnorePatterns": [
"node_modules/(?!(decode-uri-component|filter-obj|split-on-first|query-string)/)"
],
Since you've made it this far, sharing this article on your favorite social media network would be highly appreciated 💖! For feedback, please ping me on Twitter.
Discussion(login required)