Skip to content

Conversation

mrtnvh
Copy link
Contributor

@mrtnvh mrtnvh commented Jul 16, 2019

Summary

Find the UMD path using require.resolve instead of using a using a relative path based on the current working directory.

Detailed explanation

This enables support for monorepo projects. Many (dev)Dependencies in eg. Yarn Workspaces are installed in the node_modules folder in the root of the monorepo even if they are described in a package.json of a single workspace. A workspace might start a TestCafé test, initiated from the workspace folder eg. <root-of-monorepo>/packages/<workspace-folder>. Here, the functionality of this package break because it determines the UMD_PATH starting from the current working directory.

I added an extra unit test npm run test:unit:monorepo to simulate a monorepo environment a.k.a. starting the process in another folder than where the node_modules folder is found.

The original error can be recreated by running the npm run test:unit:monorepo without the applied fix.

Closes #17

I'm happy to hear your feedback!

@benmonro benmonro merged commit ae4a898 into testing-library:master Jul 16, 2019
@benmonro
Copy link
Member

Thanks @vanhoofmaarten !

@benmonro
Copy link
Member

🎉 This PR is included in version 2.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@mrtnvh
Copy link
Contributor Author

mrtnvh commented Jul 16, 2019

Thanks @vanhoofmaarten !

My pleasure!

@weyert
Copy link

weyert commented Aug 19, 2019

Top dank je wel! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error running test from sub-package in monorepo

3 participants