Skip to content

Commit

Permalink
Replace nyc with c8, ava with tape
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 4, 2021
1 parent 5fc3d19 commit df9f645
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 52 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.DS_Store
*.log
.nyc_output/
coverage/
dist/
node_modules/
Expand Down
2 changes: 1 addition & 1 deletion .remarkignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__tests__
test/fixtures/
20 changes: 4 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,26 @@
"dist",
"src/index.js"
],
"dependencies": {},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/register": "^7.0.0",
"ava": "3.0.0",
"babel-plugin-add-module-exports": "^1.0.0",
"nyc": "^15.0.0",
"c8": "^7.0.0",
"prettier": "^2.0.0",
"remark": "^13.0.0",
"remark-cli": "^9.0.0",
"remark-preset-wooorm": "^8.0.0",
"tape": "^5.0.0",
"xo": "^0.37.0"
},
"scripts": {
"prepublishOnly": "npm run compile",
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"compile": "babel src --out-dir dist --ignore src/**/__tests__",
"test-api": "ava",
"test-coverage": "nyc --reporter lcov ava",
"test-api": "node --conditions development test/index.js",
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api",
"test": "npm run compile && npm run format && npm run test-coverage"
},
"browserslist": "> 2.5%, node 6",
Expand All @@ -65,17 +64,6 @@
"add-module-exports"
]
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"ava": {
"require": [
"@babel/register"
]
},
"prettier": {
"tabWidth": 2,
"useTabs": false,
Expand Down
34 changes: 0 additions & 34 deletions src/__tests__/index.js

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const fs = require('fs')
const path = require('path')
const test = require('tape')
const remark = require('remark')
const plugin = require('../dist/index.js')

const base = path.join(__dirname, 'fixtures')

const specs = {}

fs.readdirSync(base).forEach((contents) => {
const parts = contents.split('.')
if (!specs[parts[0]]) {
specs[parts[0]] = {}
}

specs[parts[0]][parts[1]] = fs.readFileSync(
path.join(base, contents),
'utf-8'
)
})

test('remark-heading-gap', (t) => {
Object.keys(specs).forEach((name) => {
const spec = specs[name]
let options

if (name === 'three-zero') {
options = {3: {before: 0, after: 0}}
}

t.deepEqual(
remark().use(plugin, options).processSync(spec.fixture).toString(),
spec.expected,
name
)
})

t.end()
})

0 comments on commit df9f645

Please sign in to comment.