Closed jdgriffith closed 2 years ago
Will try this fix.
Still getting this error when testing against this repo alpaca-jest-issue.
FAIL ./index.spec.ts
● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
SyntaxError: Unexpected token 'export'
> 1 | import { AlpacaClient } from "@master-chief/alpaca";
| ^
2 |
3 | export const client = new AlpacaClient({
4 | credentials: {
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
at Object.<anonymous> (index.ts:1:1)
Test Suites: 1 failed, 1 total
Haha now you got me down the rabbit hole again researching this further.. 😆
I will leave this change though, thank you for the PR!
Well bum! Was hoping this was part of the fix. I noticed all tests passed locally.
I'm not 100% sure this is the issue with compilation/transpilation for Jest but seems like a good starting point. I don't believe you can hard code
.js
here and have it work for all scenarios. I know TS and javascript can handle module resolution without the file extension and assuming any build target can handle this resolution.I had to bring in your project as a git submodule to get my tests working again. FYI - the types and documentation are great!