loading...

re: Testing npm packages against multiple versions of their peer dependency VIEW POST

FULL DISCUSSION
 

Thx for this, exactly what I was looking for.

What do you think of having the "current" version as hapi in your devDependencies and only old versions with the numeric postfix? This way if tests need to be different for different versions they can be written for the specific versions and you don't need to replace anything, right?

 

I can see some advantages of not using a prefix for the current version. I'm using dependabot for automatic dependency updates and without a prefix it could create a MR to update the hapi version after a new release. In that case, my tests would fail if there was a compatibility issue and I would know about it much faster than I do now.

I'm not so sure about writing tests for specific versions of the dependency. That makes it harder to find out if the plugin works the same for all versions. I had a test that wasn't working for hapi 19 because it accessed some internal property that was made private in the newer release. I decided to remove the test case because I thought it wasn't worth it. But maybe there are some cases when it's just not possible to run the same tests against all the supported versions.

Code of Conduct Report abuse