diff --git a/.gitignore b/.gitignore index b32672d1..ad1f0e1a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ lib-cov +.nyc_output *.seed *.log *.csv diff --git a/package.json b/package.json index 94ada549..390777be 100644 --- a/package.json +++ b/package.json @@ -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" @@ -36,5 +36,8 @@ "bitbucket", "gitlab", "ghost" - ] + ], + "tap": { + "check-coverage": false + } } diff --git a/test/transform-html.js b/test/transform-html.js index 50ba1b62..8692763f 100644 --- a/test/transform-html.js +++ b/test/transform-html.js @@ -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)*', '', @@ -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)*', '', @@ -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', '', @@ -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)*', '', diff --git a/test/transform-nested-markdown.js b/test/transform-nested-markdown.js index 2210da0a..8d83fe9d 100644 --- a/test/transform-nested-markdown.js +++ b/test/transform-nested-markdown.js @@ -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)*', diff --git a/test/transform-skipTag.js b/test/transform-skipTag.js index 2517473b..3284fc23 100644 --- a/test/transform-skipTag.js +++ b/test/transform-skipTag.js @@ -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' diff --git a/test/transform-stdout.js b/test/transform-stdout.js index 85b4455c..ef2ebc11 100644 --- a/test/transform-stdout.js +++ b/test/transform-stdout.js @@ -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') @@ -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') diff --git a/test/transform-title.js b/test/transform-title.js index 70b7f847..bc55ce11 100644 --- a/test/transform-title.js +++ b/test/transform-title.js @@ -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', '', @@ -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', '', @@ -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)', diff --git a/test/transform-weird-headers.js b/test/transform-weird-headers.js index 19ddcd58..65ea1c32 100644 --- a/test/transform-weird-headers.js +++ b/test/transform-weird-headers.js @@ -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', '', @@ -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)*', '', diff --git a/test/transform.js b/test/transform.js index 6481c3cd..b5e2ef89 100644 --- a/test/transform.js +++ b/test/transform.js @@ -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() }) } @@ -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)*', '', @@ -251,7 +251,7 @@ test('transforming when old toc exists', function (t) { , 'replaces old toc' ) - t.deepEqual( + t.same( res.wrappedToc.split('\n') , [ '', '', @@ -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', '', @@ -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)*', '', @@ -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') , [ '', '', @@ -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', '',