Catbuttes/axios-ntlm

SyntaxError: Cannot use import statement outside a module

Closed this issue · 1 comments

Hey there I thank you in advance!

I'm using your package as a dependency of node-soap inside NestJS backend framework and I'm having a issue when I try to run my jest tests:

/.../my-project/node_modules/axios-ntlm/node_modules/axios/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import axios from './lib/axios.js';
                                                                                      ^^^^^^

    SyntaxError: Cannot use import statement outside a module

Having hard times resolving it, already tried all the suggestions from jest such as adding:

  moduleNameMapper: {
    axios: path.resolve(__dirname, './node_modules/axios-ntlm/node_modules/axios/index.js'),
  }

and transformIgnorePatterns: ['/node_modules/axios-ntlm/']

but nothing worked for me. Any suggestion from Your side?

Sorry my bad😅 got it solved with

  moduleNameMapper: {
    '^axios$': require.resolve('axios'),
  },