Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
lib-cov
.nyc_output
*.seed
*.log
*.csv
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"url": "git://github.com/thlorenz/doctoc.git"
},
"scripts": {
"test": "set -e; for t in test/*.js; do node $t; done"
"test": "tap"
},
"files": [
"lib"
Expand Down Expand Up @@ -36,5 +36,8 @@
"bitbucket",
"gitlab",
"ghost"
]
],
"tap": {
"check-coverage": false
}
}
8 changes: 4 additions & 4 deletions test/transform-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test('\ngiven a file that includes html with header tags and maxHeaderLevel 8',
var content = require('fs').readFileSync(__dirname + '/fixtures/readme-with-html.md', 'utf8');
var headers = transform(content, 'github.com', 8);

t.deepEqual(
t.same(
headers.toc.split('\n')
, [ '**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*',
'',
Expand All @@ -33,7 +33,7 @@ test('\ngiven a file that includes html with header tags using default maxHeader
var content = require('fs').readFileSync(__dirname + '/fixtures/readme-with-html.md', 'utf8');
var headers = transform(content);

t.deepEqual(
t.same(
headers.toc.split('\n')
, [ '**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*',
'',
Expand All @@ -53,7 +53,7 @@ test('\ngiven a file with headers embedded in code', function (t) {
var content = require('fs').readFileSync(__dirname + '/fixtures/readme-with-code.md', 'utf8');
var headers = transform(content);

t.deepEqual(
t.same(
headers.toc.split('\n')
, [ '## Table of Contents',
'',
Expand All @@ -72,7 +72,7 @@ test('\ngiven a file with benign backticks', function (t) {
var content = require('fs').readFileSync(__dirname + '/fixtures/readme-benign-backticks.md', 'utf8');
var headers = transform(content);

t.deepEqual(
t.same(
headers.toc.split('\n')
, [ '**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*',
'',
Expand Down
2 changes: 1 addition & 1 deletion test/transform-nested-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test('\nhandle inline links and images', function (t) {
var content = require('fs').readFileSync(__dirname + '/fixtures/readme-with-nested-markdown.md', 'utf8');
var headers = transform(content, null, null, '', false);

t.deepEqual(
t.same(
headers.toc.split('\n')
, [
'**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*',
Expand Down
2 changes: 1 addition & 1 deletion test/transform-skipTag.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test('\nskip file transform', function (t) {
var content = require('fs').readFileSync(__dirname + '/fixtures/readme-with-skipTag.md', 'utf8');
var transformedContent = transform(content);

t.deepEqual(
t.same(
transformedContent.toc
, undefined
, 'skip correct file'
Expand Down
4 changes: 2 additions & 2 deletions test/transform-stdout.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test('\nshould print to stdout with --stdout option', function (t) {
console.error('exec error: ', error);
return;
}
t.deepEqual(stdout
t.same(stdout
, fs.readFileSync(__dirname + '/fixtures/stdout.md', 'utf8')
, 'spits out the correct table of contents')

Expand All @@ -27,7 +27,7 @@ test('\nshould print to stdout with -s option', function (t) {
console.error('exec error: ', error);
return;
}
t.deepEqual(stdout
t.same(stdout
, fs.readFileSync(__dirname + '/fixtures/stdout.md', 'utf8')
, 'spits out the correct table of contents')

Expand Down
6 changes: 3 additions & 3 deletions test/transform-title.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test('\noverwrite existing title', function (t) {
var content = require('fs').readFileSync(__dirname + '/fixtures/readme-with-custom-title.md', 'utf8');
var headers = transform(content, null, null, '## Table of Contents', false);

t.deepEqual(
t.same(
headers.toc.split('\n')
, [ '## Table of Contents',
'',
Expand All @@ -25,7 +25,7 @@ test('\ndo not overwrite existing title', function (t) {
var content = require('fs').readFileSync(__dirname + '/fixtures/readme-with-custom-title.md', 'utf8');
var headers = transform(content, null, null, null, false);

t.deepEqual(
t.same(
headers.toc.split('\n')
, [ '## Table of Contents',
'',
Expand All @@ -42,7 +42,7 @@ test('\nclobber existing title', function (t) {
var content = require('fs').readFileSync(__dirname + '/fixtures/readme-with-custom-title.md', 'utf8');
var headers = transform(content, null, null, null, true);

t.deepEqual(
t.same(
headers.toc.split('\n')
, [ '',
'- [Installation](#installation)',
Expand Down
4 changes: 2 additions & 2 deletions test/transform-weird-headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test('\ngiven a file with edge-case header names', function (t) {
var content = require('fs').readFileSync(__dirname + '/fixtures/readme-with-weird-headers.md', 'utf8');
var headers = transform(content);

t.deepEqual(
t.same(
headers.toc.split('\n')
, [ '## Table of Contents',
'',
Expand All @@ -25,7 +25,7 @@ test('\nnameless table headers', function (t) {
var content = require('fs').readFileSync(__dirname + '/fixtures/readme-nameless-table-headers.md', 'utf8');
var headers = transform(content);

t.deepEqual(
t.same(
headers.toc.split('\n')
, [ '**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*',
'',
Expand Down
14 changes: 7 additions & 7 deletions test/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function check(md, anchors, mode, maxHeaderLevel, title, notitle, entryPrefix, p
.concat(mdLines);

t.ok(res.transformed, 'transforms it');
t.deepEqual(data, rig, 'generates correct anchors')
t.same(data, rig, 'generates correct anchors')
t.end()
})
}
Expand Down Expand Up @@ -242,7 +242,7 @@ test('transforming when old toc exists', function (t) {

t.ok(res.transformed, 'transforms it')

t.deepEqual(
t.same(
res.toc.split('\n')
, [ '**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*',
'',
Expand All @@ -251,7 +251,7 @@ test('transforming when old toc exists', function (t) {
, 'replaces old toc'
)

t.deepEqual(
t.same(
res.wrappedToc.split('\n')
, [ '<!-- START doctoc generated TOC please keep comment here to allow auto update -->',
'<!-- DON\'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->',
Expand All @@ -264,7 +264,7 @@ test('transforming when old toc exists', function (t) {
, 'wraps old toc'
)

t.deepEqual(
t.same(
res.data.split('\n')
, [ '# Header above',
'',
Expand Down Expand Up @@ -307,7 +307,7 @@ test('transforming when old toc exists and --all flag is set', function (t) {

t.ok(res.transformed, 'transforms it')

t.deepEqual(
t.same(
res.toc.split('\n')
, [ '**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*',
'',
Expand All @@ -317,7 +317,7 @@ test('transforming when old toc exists and --all flag is set', function (t) {
, 'replaces old toc'
)

t.deepEqual(
t.same(
res.wrappedToc.split('\n')
, [ '<!-- START doctoc generated TOC please keep comment here to allow auto update -->',
'<!-- DON\'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->',
Expand All @@ -331,7 +331,7 @@ test('transforming when old toc exists and --all flag is set', function (t) {
, 'wraps old toc'
)

t.deepEqual(
t.same(
res.data.split('\n')
, [ '# Header above',
'',
Expand Down