ladjs / supertest

🕷 Super-agent driven library for testing node.js HTTP servers using a fluent API. Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: SyntaxError: Cannot use import statement outside a module

humaidk2 opened this issue · comments

Kept getting this when I was running tests using jest

SyntaxError: Cannot use import statement outside a module

After much investigation found out that supertest uses superagent on the latest version which is not recommended

superagent@8.0.2: Please use v8.0.0 until https://github.com/visionmedia/superagent/issues/1743 is resolved

Had to fix it by adding resolution to my package.json

"resolutions": {
        "superagent": "8.0.0"
    },

Hopefully, superagent@8.1.0 comes out this week and no one has the same issue

Closed cause superagent:8.0.3 is out which fixes this

Similar to #798