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

Add instructions for how to run tests in readme #357

Open
mikowals opened this issue Apr 15, 2022 · 3 comments
Open

Add instructions for how to run tests in readme #357

mikowals opened this issue Apr 15, 2022 · 3 comments

Comments

@mikowals
Copy link

mikowals commented Apr 15, 2022

Hi,

I am interested in exploring the existing tests and writing some new ones to check behaviour with React 18 and concurrency. I am on an M1 MacBook and needed to update Meteor so that may be the root of my issues. I can copy the tests out of this repository and they run though so I may also be misunderstanding how they should be run.

I have tried:

cd tests/react-meteor-data-harness
meteor npm install
meteor npm test

This required manually meteor npm install @babel/runtime jquery and ultimately errors in the browser with - exception - message Can't find variable: ReactMeteorData

Next approach also from tests/react-meteor-data-harness:

PACKAGE_DIRS=../../packages meteor test-packages  // Errored with missing dev packages
meteor npm i --save-dev @testing-library/react@^12.0.0 @testing-library/react-hooks
PACKAGE_DIRS=../../packages meteor test-packages  // Test results in browser but all fail     
meteor npm I --save react@^17.0.0 react-dom@^17.0.0 
PACKAGE_DIRS=../../packages meteor test-packages

Ultimately getting many green tests but hanging indefinitely in useTracker resubscribe tests.

My thought is that with many permutations of running npm install, npm test, meteor test, and meteor test-packages at various directory levels it would be helpful to add a few sentences describing a combination that is expected to work. A link to a CI script that run the tests would also be helpful if one exists.

It may be that the correct path is meant to be:

cd tests/react-meteor-data-harness
meteor npm install
meteor npm test
PACKAGE_DIRS=../../packages meteor test-packages

And all my problems stem from M1 and the Meteor update resulting in missing dependencies. If so I am happy to make a pull request adding these instructions and ignoring my update journey. Adding a package.json script to run the package tests would also simplify and clarify the process.

@CaptainN
Copy link
Collaborator

CaptainN commented May 23, 2022

The challenge with these tests is they are very old, and SimpleTest is not well documented. I kind of loathe it, but it's what we have.

To get the tests to work, first of all, install the local npm packages. Note, they have to be installed as regular dependencies, not dev dependencies. (And they should be removed before publishing, which should also be documented somewhere.)

The next step is to run it with an older version of meteor! New version don't work due to various bugs. CD in to the react-packages/packages/react-meteor-data folder, install the deps with meteor npm i then run with an older version:

meteor test-packages ./ --release 1.12.1

On M1 you'll need to specify arch to get it to run in rosetta 2

arch -x86_64 meteor test-packages ./ --release 1.12.1

It will be very very slow... It might even stall a couple of times (like at the end of the first time a given version's meteor-tool installs), but eventually it will start.

I don't think it matters which version or arch of node/npm you use to install the node_modules, because it doesn't rely on any native modules, but maybe stick with some variant of npm 6.

The tests in the individual packages are not integrated in the repo's main test harness. That maybe is for the older packages? IDK.

@henriquealbert
Copy link
Member

@CaptainN what do we need to do to update those tests and also keep it with the latest Meteor version available?

@CaptainN
Copy link
Collaborator

There are bugs in the latest versions of Meteor that cause the tests to fail (mostly with node_modules path resolution inside packages). Those bugs need to be fixed.

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

No branches or pull requests

3 participants