We need to integrate Karma test runner into TeamCity and for that I'd like to give sys-engineers small script (powershell or whatever) that would:
-
pick up desired version number from some config file (I guess I can put it as a comment right in the
karma.conf.js
) -
check if the defined version of karma runner installed in npm's global repo
-
if it's not, or the installed version is older than desired: pick up and install right version
-
run it:
karma start .\Scripts-Tests\karma.conf.js --reporters teamcity --single-run
So my real question is: "how can one check in a script, if desired version of package installed?". Should you do the check, or it's safe to just call npm -g install
everytime?
I don't want to always check and install the latest available version, because other config values may become incompatible
Best Answer
To check if any module in a project is 'old':
'outdated' will check every module defined in
package.json
and see if there is a newer version in the NPM registry.For example, say
xml2js 0.2.6
(located innode_modules
in the current project) is outdated because a newer version exists (0.2.7). You would see:To update all dependencies, if you are confident this is desirable:
Or, to update a single dependency such as
xml2js
: