I recently discovered the npm version [major|minor|patch]
mand to automatically bump the package version number and mit the changes. This was a magical little discovery.
Is it possible to run tests prior to the bump & git mit with npm? Trying to avoid having to write a bash script.
I can't find anything on google or stack search "npm version ....." matches too many unrelated results. And there is no info about testing in the docs npm-version
I was begging to write a script before this discovery. To test, bump version, then git mit.
I'm using karma, package.json contains
"scripts": {
"test": "karma run"
}
While testing the npm version mand I added a failing test
it("force fail",function(){
expect(true).toEqual(1);
});
So karma run
and npm test
both result in a failed test run. I was hoping this would stop the version patch, but no luck. I managed to bump and mit with failing tests.
I recently discovered the npm version [major|minor|patch]
mand to automatically bump the package version number and mit the changes. This was a magical little discovery.
Is it possible to run tests prior to the bump & git mit with npm? Trying to avoid having to write a bash script.
I can't find anything on google or stack search "npm version ....." matches too many unrelated results. And there is no info about testing in the docs npm-version
I was begging to write a script before this discovery. To test, bump version, then git mit.
I'm using karma, package.json contains
"scripts": {
"test": "karma run"
}
While testing the npm version mand I added a failing test
it("force fail",function(){
expect(true).toEqual(1);
});
So karma run
and npm test
both result in a failed test run. I was hoping this would stop the version patch, but no luck. I managed to bump and mit with failing tests.
1 Answer
Reset to default 3Adding them to scripts
could work, though I really would remend just defining a function in your shell’s runtime configuration.
"scripts": {
"test": "karma run",
"major": "karma run && npm version major && git mit",
"minor": "karma run && npm version minor && git mit",
"patch": "karma run && npm version patch && git mit"
}