Skip to content

Commit 365c98b

Browse files
committed
chore(readify) lint
1 parent f6a3eed commit 365c98b

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed

.madrun.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ const {run} = require('madrun');
44

55
module.exports = {
66
'lint': () => 'putout .',
7+
'fresh:lint': () => run('lint', '--fresh'),
8+
'lint:fresh': () => run('lint', '--fresh'),
79
'fix:lint': () => run('lint', '--fix'),
810
'report': () => 'nyc report --reporter=text-lcov | coveralls',
911
'coverage': () => 'nyc npm test',

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ console.log(data);
4040
// output
4141
({
4242
path: '/',
43-
files: [{
43+
files: [{
4444
name: 'readify.js',
4545
size: '4.22kb',
4646
date: '20.02.2016',
@@ -54,7 +54,7 @@ readify('/', {type: 'raw'}).then(console.log);
5454
// output
5555
({
5656
path: '/',
57-
files: [{
57+
files: [{
5858
name: 'readify.js',
5959
size: 4735,
6060
date: '2016-11-21T13:37:55.275Z',
@@ -68,7 +68,7 @@ readify('/', {type: 'raw', sort: 'size', order: 'desc'}).then(console.log);
6868
// output
6969
({
7070
path: '/',
71-
files: [{
71+
files: [{
7272
name: 'readify.js',
7373
size: 4735,
7474
date: '2016-11-21T13:37:55.275Z',

package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@
88
"type": "git",
99
"url": "git://github.com/coderaiser/readify.git"
1010
},
11-
"nyc": {
12-
"exclude": [
13-
".madrun.js",
14-
"test"
15-
]
16-
},
1711
"scripts": {
1812
"lint": "madrun lint",
1913
"fix:lint": "madrun fix:lint",
@@ -62,7 +56,8 @@
6256
"nodemon": "^2.0.1",
6357
"nyc": "^15.0.0",
6458
"putout": "^13.1.2",
65-
"supertape": "^4.4.0"
59+
"supertape": "^4.4.0",
60+
"try-catch": "^3.0.0"
6661
},
6762
"publishConfig": {
6863
"access": "public"

test/readdir.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ test('readdir: result: no error', async (t) => {
123123
stopAll();
124124
fs.promises.readdir = readdir;
125125

126-
t.notOk(e, e && e.message || 'should not receive error');
126+
t.notOk(e, e?.message || 'should not receive error');
127127
t.end();
128128
});
129129

@@ -198,7 +198,7 @@ test('readdir: result: directory link: no error', async (t) => {
198198
stopAll();
199199
fs.promises.readdir = readdir;
200200

201-
t.notOk(e, e && e.message || 'should not receive error');
201+
t.notOk(e, e?.message || 'should not receive error');
202202
t.end();
203203
});
204204

test/readify.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const test = require('supertape');
44
const stub = require('@cloudcmd/stub');
55
const tryToCatch = require('try-to-catch');
6+
const tryCatch = require('try-catch');
67
const mockRequire = require('mock-require');
78
const shortdate = require('shortdate');
89
const {reRequire} = mockRequire;
@@ -232,13 +233,17 @@ test('result: file names should not be empty', async (t) => {
232233
throw Error('Filename should not be empty!\n' + JSON.stringify(file));
233234
});
234235

236+
const [isThrow] = tryCatch(check);
237+
235238
t.notOk(e, 'no error');
236-
t.doesNotThrow(check, 'should not throw');
239+
t.notOk(isThrow, 'should not throw');
240+
237241
t.end();
238242
});
239243

240244
test('arguments: exception when no path', async (t) => {
241245
const [e] = await tryToCatch(readify);
246+
242247
t.equal(e.message, 'path should be string!', 'should throw when no path');
243248
t.end();
244249
});

0 commit comments

Comments
 (0)