sheremet-va / vitest-react-native

63 stars 5 forks source link

Was able to run plugin with this changes #13

Closed cah4a closed 1 year ago

cah4a commented 1 year ago

1) Currently, vitest automatically attempts to transpile react-native, which leads to errors due to its inability to understand flow syntax. To resolve this, it's necessary to add react-native to server.deps.external.

2) Not all code was being transpiled as expected due to the lack of a .ios.js extension in the pirates.addHook. And since .ios.js is a lookup extension, there’s no need to replace it within the code.

3) It seems that resolve.conditions doesn’t serve any purpose, so I’ve removed it.

sheremet-va commented 1 year ago

3. It seems that resolve.conditions doesn’t serve any purpose, so I’ve removed it.

There is literally a comment where it's explained why this condition is needed.

cah4a commented 1 year ago
// plugin adds this condition automatically

Am I reading it wrong or it does tell nothing about why it's needed?

sheremet-va commented 1 year ago
// plugin adds this condition automatically

Am I reading it wrong or it does tell nothing about why it's needed?

Sorry, I remembered it wrong. This condition is needed for libraries that define a custom exports condition: https://reactnative.dev/blog/2023/06/21/package-exports-support#the-new-react-native-condition

cah4a commented 1 year ago

Got you. It's required for third-party react-native libraries.

I've rolled back this change.

cah4a commented 1 year ago

Thanks!

cah4a commented 1 year ago

Hello @sheremet-va,

Could you please release a version with this change?

sheremet-va commented 1 year ago

Hello @sheremet-va,

Could you please release a version with this change?

Released as 0.1.4

cah4a commented 1 year ago

A huge thanks!