Open aivarsak opened 1 year ago
The workaround I use:
Modify web/src/auth.ts
to
let dbAuthClient
if (process.env.NODE_ENV === 'test') {
dbAuthClient = createDbAuthClient()
} else {
const WebAuthnClient = require('@redwoodjs/auth-dbauth-web/webAuthn').default
dbAuthClient = createDbAuthClient({ webAuthn: new WebAuthnClient() })
}
Thanks @aivarsak
Thoughts on next steps here (if any) @cannikin?
Hmm, is this one of those annoying ES6 issues? I think @dac09 has an issue somewhere to get us to support ES6 modules natively, and then this should be taken care of. If we didn't have a fix on the horizon I would say we could modify the auth.js
template to include @aivarsak 's workaround. But, if we do plan on fixing it soon, maybe add just add the workaround to the Webauthn docs? You pretty much have to read those to get Webauthn working, so if anyone enables it they're probably going to see the notice (we'll put it in a big yellow WARNING box).
The bit from @aivarsak works for that package, but if you have any other ESM imports you'll need to add them as transformIgnorePatterns
to the web jest.config.js. e.g.,
transformIgnorePatterns: [
'/node_modules/(?!(my-esm-thingy)/)',
],
What's not working?
all
render
tests fail withHow do we reproduce the bug?
Create new app ( v4.4.3 or canary)
yarn create redwood-app --ts ./redwood-app
Add at least one page
yarn redwood generate page home /
Setup dbAuth with enabled
WebAuthn
. You will be prompted to ask if you want to enable WebAuthn supportyarn rw setup auth dbAuth
run tests
yarn rw test
observe the error
What's your environment? (If it applies)
Are you interested in working on this?