Esse é o codigo q estou tentando executar:
import getFile from '../index.js';
// const getFile = require('../index');
test('deve ser uma função', () => {
expect(typeof getFile).toBe('function');
});
Aparece essa msg:
{"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import getFile from '../index.js'; // const getFile = require('../index');
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1728:14)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 0.733 s
Ran all test suites matching /.\/test\/index.test.js/i.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! md-links@0.1.0 test: `jest ./test/index.test.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the md-links@0.1.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/CaroAlvim/.npm/_logs/2021-12-30T01_10_16_832Z-debug.log