Skip to content

Commit

Permalink
Also test 'hallmark --fix' on dependents
Browse files Browse the repository at this point in the history
  • Loading branch information
vweevers committed Aug 9, 2019
1 parent b6011c2 commit 06a2e34
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"devDependencies": {
"git-pull-or-clone": "^1.3.0",
"level-community": "^3.0.0",
"rimraf": "^2.6.3",
"standard": "^13.0.1",
"tape": "^4.10.2",
"vfile-reporter-json": "^2.0.0"
Expand Down
24 changes: 22 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const test = require('tape')
const path = require('path')
const gitPullOrClone = require('git-pull-or-clone')
const rimraf = require('rimraf')
const cp = require('child_process')

const dependents = [
Expand All @@ -29,7 +30,7 @@ for (const repo of dependents) {
const url = `https://github.com/${repo}.git`

test(`smoke test ${repo}`, function (t) {
t.plan(2)
t.plan(5)

// Clone fully because we need git history for remark-git-contributors
gitPullOrClone(url, cwd, { depth: Infinity }, (err) => {
Expand All @@ -40,7 +41,26 @@ for (const repo of dependents) {
const cli = path.join(__dirname, 'cli.js')

cp.fork(cli, { cwd, stdio }).on('exit', function (code) {
t.is(code, 0, 'hallmark exited with code 0')
t.is(code, 0, 'hallmark linter exited with code 0')

// Skip CONTRIBUTORS.md for now (many dependents need updating)
const args = ['--fix', '-i', 'CONTRIBUTORS.md']

cp.fork(cli, args, { cwd, stdio }).on('exit', function (code) {
t.is(code, 0, 'hallmark fixer exited with code 0')

cp.execFile('git', ['diff'], { cwd }, function (err, stdout) {
const diff = (stdout || '').trim()

t.ifError(err, 'no git error')
t.is(diff, '', 'no diff')

if (diff !== '') {
// Start fresh on the next test run
rimraf.sync(cwd, { glob: false })
}
})
})
})
})
})
Expand Down

0 comments on commit 06a2e34

Please sign in to comment.