Skip to content

Commit af978ca

Browse files
committed
Move markdown to tap-markdown
1 parent 2a8a712 commit af978ca

22 files changed

+81
-253
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ or in `package.json`
2828
```
2929
--no-ansi Disable ANSI formatting
3030
--no-progress Disable progress output during tests
31-
--markdown Format output as markdown
3231
```
3332

3433
## Example

bin/cmd.js

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,14 @@ var program = new Command('tap-summary')
55

66
program
77
.version(require('../package.json').version)
8-
.option('--no-ansi', 'Disable ANSI formatting. Only valid for the default formatter.')
9-
.option('--no-progress', 'Disable progress output during tests. Only valid for the default formatter.')
10-
.option('-m, --markdown', 'Use the markdown formatter.')
11-
.option('-f, --formatter <formatter>', 'Specify how to format the output. `markdown` and `default` are available.')
8+
.option('--no-ansi', 'Disable ANSI formatting.')
9+
.option('--no-progress', 'Disable progress output during tests.')
1210
.parse(process.argv)
1311

14-
var reporter
15-
if (program.markdown || program.formatter === 'markdown') {
16-
reporter = require('../lib/markdown')()
17-
} else {
18-
reporter = require('..')({
19-
ansi: program.ansi,
20-
progress: program.progress,
21-
})
22-
}
23-
12+
var reporter = require('..')({
13+
ansi: program.ansi,
14+
progress: program.progress,
15+
})
2416

2517
process.stdin
2618
.pipe(reporter)

index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
module.exports = require('./lib/screen')
1+
var reporter = require('./lib/reporter')
2+
var Formatter = require('./lib/formatter')
3+
4+
module.exports = function (opts) {
5+
return reporter(new Formatter(opts))
6+
}
7+
module.exports.Formatter = Formatter
8+
module.exports.reporter = reporter
9+
module.exports.parser = require('./lib/parser')
10+

lib/screen.js renamed to lib/formatter.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ var symbols = require('figures')
33
var prettyMs = require('pretty-ms')
44
var LF = '\n'
55

6-
var reporter = require('./reporter')
7-
8-
module.exports = function (opts) {
9-
return reporter(new Formatter(opts))
10-
}
11-
module.exports.Formatter = Formatter
6+
module.exports = Formatter
127

138
function Formatter(opts) {
149
opts = opts || {}

lib/markdown.js

Lines changed: 0 additions & 70 deletions
This file was deleted.
File renamed without changes.

lib/reporter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
var summarize = require('./summarize')
1+
var parser = require('./parser')
22

33
module.exports = function (formatter) {
4-
var reporter = summarize()
4+
var reporter = parser()
55

66
if (formatter.init) {
77
formatter.init(reporter)
File renamed without changes.
File renamed without changes.
File renamed without changes.

test/fixtures/markdown.comment.expected

Lines changed: 0 additions & 19 deletions
This file was deleted.

test/fixtures/markdown.fail.expected

Lines changed: 0 additions & 26 deletions
This file was deleted.

test/fixtures/markdown.summary.expected

Lines changed: 0 additions & 10 deletions
This file was deleted.
File renamed without changes.

test/markdown.js

Lines changed: 0 additions & 41 deletions
This file was deleted.

test/summarize.js renamed to test/parser.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
var test = require('tape')
2-
var summarize = require('../lib/summarize')
2+
var parser = require('../lib/parser')
33
var fs = require('fs')
44
var path = require('path')
55
var fixtures = path.resolve.bind(path, __dirname, 'fixtures')
66

7-
test('summarize.summary', function (t) {
8-
fs.createReadStream(fixtures('tape.summary.tap'))
9-
.pipe(summarize())
7+
test('parser.summary', function (t) {
8+
fs.createReadStream(fixtures('summary.tap'))
9+
.pipe(parser())
1010
.on('summary', function (summary) {
1111
t.equal(summary.planned, 3, 'planned')
1212
t.equal(summary.assertions, 3, 'assertions')
@@ -17,9 +17,9 @@ test('summarize.summary', function (t) {
1717
})
1818
})
1919

20-
test('summarize.summary, unnamed', function (t) {
21-
fs.createReadStream(fixtures('tape.summary.unnamed.tap'))
22-
.pipe(summarize())
20+
test('parser.summary, unnamed', function (t) {
21+
fs.createReadStream(fixtures('summary.unnamed.tap'))
22+
.pipe(parser())
2323
.on('summary', function (summary) {
2424
t.equal(summary.planned, 3, 'planned')
2525
t.equal(summary.assertions, 3, 'assertions')
@@ -30,9 +30,9 @@ test('summarize.summary, unnamed', function (t) {
3030
})
3131
})
3232

33-
test('summarize.fail', function (t) {
34-
fs.createReadStream(fixtures('tape.fail.tap'))
35-
.pipe(summarize())
33+
test('parser.fail', function (t) {
34+
fs.createReadStream(fixtures('fail.tap'))
35+
.pipe(parser())
3636
.on('summary', function (summary, fails) {
3737
t.equal(summary.planned, 4, 'planned')
3838
t.equal(summary.assertions, 4, 'assertions')
@@ -44,9 +44,9 @@ test('summarize.fail', function (t) {
4444
})
4545
})
4646

47-
test('summarize.comment', function (t) {
48-
fs.createReadStream(fixtures('tape.comment.tap'))
49-
.pipe(summarize())
47+
test('parser.comment', function (t) {
48+
fs.createReadStream(fixtures('comment.tap'))
49+
.pipe(parser())
5050
.on('summary', function (summary, fails, comments) {
5151
t.equal(summary.planned, 2, 'planned')
5252
t.equal(summary.assertions, 2, 'assertions')

test/reporter.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
var test = require('tape')
2+
var summarize = require('..')
3+
var fs = require('fs')
4+
var path = require('path')
5+
var fixtures = path.resolve.bind(path, __dirname, 'fixtures')
6+
var concat = require('concat-stream')
7+
8+
test('summary ansi', function (t) {
9+
fs.createReadStream(fixtures('summary.tap'))
10+
.pipe(summarize({ duration: false, progress: false }))
11+
.pipe(concat({ encoding: 'string' }, function (s) {
12+
t.equal(s, fs.readFileSync(fixtures('summary.ansi.expected'), 'utf8'))
13+
t.end()
14+
}))
15+
})
16+
17+
test('summary no ansi', function (t) {
18+
fs.createReadStream(fixtures('summary.tap'))
19+
.pipe(summarize({ duration: false, progress: false, ansi: false }))
20+
.pipe(concat({ encoding: 'string' }, function (s) {
21+
t.equal(s, fs.readFileSync(fixtures('summary.noansi.expected'), 'utf8'))
22+
t.end()
23+
}))
24+
})
25+
26+
test('fail', function (t) {
27+
var formatter = new summarize.Formatter({ duration: false, progress: false })
28+
formatter.prettifyError = function (assertion) {
29+
var lines = assertion.error.raw.split('\n')
30+
lines.pop()
31+
return lines.join('\n')
32+
}
33+
fs.createReadStream(fixtures('fail.tap'))
34+
.pipe(summarize.reporter(formatter))
35+
.pipe(concat({ encoding: 'string' }, function (s) {
36+
t.equal(s, fs.readFileSync(fixtures('fail.expected'), 'utf8'))
37+
t.end()
38+
}))
39+
})
40+
41+
test('comment', function (t) {
42+
fs.createReadStream(fixtures('comment.tap'))
43+
.pipe(summarize({ duration: false, progress: false }))
44+
.pipe(concat({ encoding: 'string' }, function (s) {
45+
t.equal(s, fs.readFileSync(fixtures('comment.expected'), 'utf8'))
46+
t.end()
47+
}))
48+
})
49+

0 commit comments

Comments
 (0)