Skip to content

Commit

Permalink
Merge pull request #59 from artemv/custom-commands
Browse files Browse the repository at this point in the history
feat: allow 'pretest' to be custom command, too
  • Loading branch information
artemv authored Oct 25, 2017
2 parents 7bd9c78 + 8f40078 commit 142a6d2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,24 @@ was working before the update. If this sounds excessive to you you can disable i
"name": "foo-module-name",
"test": "grunt test",
"pretest": false
},
"bar-name"
}
]
```
Here "foo-module-name" module will be tested only once, and "bar-name" twise: first with its published version of
current module, and then with the updated version.

The "pretest" property can also accept custom script to run for pretesting:
```
[
{
"name": "foo-module-name",
"test": "grunt test",
"pretest": "grunt test && ./ci/after-pretesting-by-dont-break"
}
]
```
By default it equals to "test" command.

### Post-install command

Before testing the dependent package dont-break installs its dev dependencies via `npm install` command run from the
Expand Down
9 changes: 8 additions & 1 deletion src/dont-break.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,16 @@ function testDependent (options, dependent) {
})

if (testWithPreviousVersion) {
var modulePretestCommand
if (check.type('string', testWithPreviousVersion)) {
modulePretestCommand = testWithPreviousVersion
} else {
modulePretestCommand = moduleTestCommand
}
var pretestModuleInFolder = _.partial(testInFolder, modulePretestCommand)
res = res
.then(postInstallModuleInFolder)
.then(testModuleInFolder)
.then(pretestModuleInFolder)
}

return res
Expand Down

0 comments on commit 142a6d2

Please sign in to comment.