I'm trying to run a test using Jest, and so I'm importing the following at the top of my test file:
import { describe, it, expect } from '@jest/globals'
However, when I run the test, I get the following error: SyntaxError: Cannot use import statement outside a module
How do I solve this?
I figured out how to fix it. Instead, just use the CommonJS form of the statement at the top, as follows:
const { describe, it, expect } = require('@jest/globals')