Skip to content

Commit 30afb71

Browse files
committed
chore: remove async dev dep
1 parent db9c672 commit 30afb71

File tree

4 files changed

+57
-90
lines changed

4 files changed

+57
-90
lines changed

package-lock.json

+7-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"validate-npm-package-license": "^3.0.1"
2020
},
2121
"devDependencies": {
22-
"async": "^2.6.1",
2322
"tap": "^14.10.8"
2423
},
2524
"files": [

test/consistency.js

+23-33
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,25 @@
1-
var tap = require("tap")
2-
var normalize = require("../lib/normalize")
3-
var path = require("path")
4-
var fs = require("fs")
5-
var async = require("async")
1+
const t = require("tap")
2+
const normalize = require("../lib/normalize")
3+
const fs = require("fs")
4+
const { promisify } = require("util")
5+
const readFile = promisify(fs.readFile)
6+
const readdir = promisify(fs.readdir)
67

7-
var data, clonedData
8-
var warn
98

10-
tap.test("consistent normalization", function(t) {
11-
path.resolve(__dirname, "./fixtures/read-package-json.json")
12-
fs.readdir (__dirname + "/fixtures", function (err, entries) {
13-
// entries = ['coffee-script.json'] // uncomment to limit to a specific file
14-
verifyConsistency = function(entryName, next) {
15-
warn = function(msg) {
16-
// t.equal("",msg) // uncomment to have some kind of logging of warnings
17-
}
18-
filename = __dirname + "/fixtures/" + entryName
19-
fs.readFile(filename, function(err, contents) {
20-
if (err) return next(err)
21-
data = JSON.parse(contents.toString())
22-
normalize(data, warn)
23-
clonedData = { ...data }
24-
normalize(data, warn)
25-
t.deepEqual(clonedData, data,
26-
"Normalization of " + entryName + " is consistent.")
27-
next(null)
28-
}) // fs.readFile
29-
} // verifyConsistency
30-
async.forEach(entries, verifyConsistency, function(err) {
31-
if (err) throw err
32-
t.end()
33-
})
34-
}) // fs.readdir
35-
}) // tap.test
9+
t.test("consistent normalization", async t => {
10+
const entries = await readdir(__dirname + "/fixtures")
11+
const verifyConsistency = async (entryName) => {
12+
const warn = () => null
13+
const filename = __dirname + "/fixtures/" + entryName
14+
const contents = await readFile(filename)
15+
16+
const data = JSON.parse(contents.toString())
17+
normalize(data, warn)
18+
const clonedData = { ...data }
19+
normalize(data, warn)
20+
t.deepEqual(clonedData, data,
21+
"Normalization of " + entryName + " is consistent.")
22+
}
23+
24+
return Promise.all(entries.map(i => verifyConsistency(i)))
25+
})

test/github-urls.js

+27-36
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,35 @@
1-
var tap = require("tap")
2-
var normalize = require("../lib/normalize")
3-
var fs = require("fs")
4-
var async = require("async")
1+
const t = require("tap")
2+
const normalize = require("../lib/normalize")
3+
const fs = require("fs")
4+
const { promisify } = require("util")
5+
const readFile = promisify(fs.readFile)
56

6-
var data
7-
var warn
87

9-
tap.test("consistent normalization", function(t) {
10-
var entries = [
8+
t.test("consistent normalization", async t => {
9+
const entries = [
1110
'read-package-json.json',
1211
'http-server.json',
1312
"movefile.json",
1413
"node-module_exist.json"
1514
]
16-
var verifyConsistency = function(entryName, next) {
17-
warn = function(msg) {
18-
// t.equal("",msg) // uncomment to have some kind of logging of warnings
15+
const verifyConsistency = async (entryName) => {
16+
const warn = () => null
17+
const filename = __dirname + "/fixtures/" + entryName
18+
const contents = await readFile(filename)
19+
const data = JSON.parse(contents.toString())
20+
normalize(data, warn)
21+
if(data.name == "node-module_exist") {
22+
t.same(data.bugs.url, "https://gist.github.com/3135914")
1923
}
20-
var filename = __dirname + "/fixtures/" + entryName
21-
fs.readFile(filename, function(err, contents) {
22-
if (err) return next(err)
23-
data = JSON.parse(contents.toString())
24-
normalize(data, warn)
25-
if(data.name == "node-module_exist") {
26-
t.same(data.bugs.url, "https://gist.github.com/3135914")
27-
}
28-
if(data.name == "read-package-json") {
29-
t.same(data.bugs.url, "https://github.com/isaacs/read-package-json/issues")
30-
}
31-
if(data.name == "http-server") {
32-
t.same(data.bugs.url, "https://github.com/nodejitsu/http-server/issues")
33-
}
34-
if(data.name == "movefile") {
35-
t.same(data.bugs.url, "https://github.com/yazgazan/movefile/issues")
36-
}
37-
next(null)
38-
}) // fs.readFile
39-
} // verifyConsistency
40-
async.forEach(entries, verifyConsistency, function(err) {
41-
if (err) throw err
42-
t.end()
43-
})
44-
}) // tap.test
24+
if(data.name == "read-package-json") {
25+
t.same(data.bugs.url, "https://github.com/isaacs/read-package-json/issues")
26+
}
27+
if(data.name == "http-server") {
28+
t.same(data.bugs.url, "https://github.com/nodejitsu/http-server/issues")
29+
}
30+
if(data.name == "movefile") {
31+
t.same(data.bugs.url, "https://github.com/yazgazan/movefile/issues")
32+
}
33+
}
34+
return Promise.all(entries.map(i => verifyConsistency(i)))
35+
})

0 commit comments

Comments
 (0)