Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing with Jest fails #2

Open
ackushiw-rialtic opened this issue Aug 1, 2022 · 3 comments
Open

Testing with Jest fails #2

ackushiw-rialtic opened this issue Aug 1, 2022 · 3 comments

Comments

@ackushiw-rialtic
Copy link

Using Hono's starter template https://honojs.dev/docs/getting-started/cloudflare-workers/ running a test fails with the following message:

Jest encountered an unexpected token

Details:

<PROJECT_ROOT>/node_modules/.pnpm/[email protected]/node_modules/jose/dist/browser/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){export { compactDecrypt } from './jwe/compact/decrypt.js';
                                                                                  ^^^^^^

SyntaxError: Unexpected token 'export'

      at Runtime.createScriptFromCode (../../node_modules/.pnpm/[email protected]/node_modules/jest-runtime/build/index.js:1796:14)
      at Object.<anonymous> (../../node_modules/.pnpm/[email protected]/node_modules/cloudflare-cognito-jwt-verifier/src/index.ts:1:1)
@frankleng
Copy link
Owner

@ackushiw-rialtic seems like it's importing .ts without compiling. are you using ts-jest?
if u make a repo to reproduce this i'll take a look.

PSA - I no longer use Cognito. it's buggy.

@ackushiw-rialtic
Copy link
Author

I tried it with ts-jest and without. I'll do some further research. Out of curiosity what were the bugs you found in Cognito and what are you using now?

@frankleng
Copy link
Owner

frankleng commented Aug 4, 2022

I tried it with ts-jest and without. I'll do some further research. Out of curiosity what were the bugs you found in Cognito and what are you using now?

there were many. what broke the camels back was aws-amplify/amplify-flutter#1716
(not specific to amplify-flutter, but Cognito itself)
it's a 5+ yr bug that forces the user to oauth twice during signup.
we now use Firebase auth (it's even free...), and u can use https://github.com/frankleng/cloudflare-firebase-jwt-verifier for cf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants