I have a monorepo setup where the project running tests is trying to load a file from outside the current working directory.
Directory structure
root
mainApp
src...
library
greetings.js
Run Code Online (Sandbox Code Playgroud)
Within greetings.js
export const greetings = "hello World!"
Run Code Online (Sandbox Code Playgroud)
Every time I try to import from greetings.js in my mainApp test files
//mainApp.test.js
import {greetings} from "../../greetings.js";
Run Code Online (Sandbox Code Playgroud)
I get error from Jest in console
Jest encountered an unexpected token
SyntaxError: Unexpected token export
Run Code Online (Sandbox Code Playgroud)
One solution in the following url is to add …