Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing against multiple node module versions

I'm developing several node modules which extend the functionality of the Sequelize database ORM module. I'm using Travis to run tests before pushing new versions of my modules to NPM.

Travis allows you to run tests against different versions of node (v0.10, v0.12 etc). Similarly, I'd like to be able to run my tests using various different versions of the Sequelize module. i.e. run the tests once using Sequelize 2.0.0, again using 2.0.1, 2.0.2 etc.

Travis loads modules from NPM automatically according the the versions set in the package.json file, and so only runs tests using the latest module version available according to what's specified in the package.json of my module (in this case ^2.0.0).

Is there any way to interfere with this process and get Travis to run the tests multiple times using a different Sequelize version each time?

I've searched for advice on this on Stack Overflow and elsewhere but not had any luck. But I assume I can't be the only person who wants to do this...

like image 237
Overlook Motel Avatar asked Mar 17 '23 19:03

Overlook Motel


1 Answers

In the end the solution I came up with is to put the following in the travis.yml file:

before_script:
  - 'if [ "$SEQ_VERSION" ]; then npm install sequelize@^$SEQ_VERSION.0.0; fi'

env:
  - SEQ_VERSION=2
  - SEQ_VERSION=3

(with thanks to Sandro Munda for his answer which put me on the right track)

like image 183
Overlook Motel Avatar answered Mar 22 '23 12:03

Overlook Motel