Skip to content

Commit 034d43e

Browse files
committed
test: fix tests and lint
1 parent e8b7d12 commit 034d43e

2 files changed

Lines changed: 1 addition & 17 deletions

File tree

format.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const diff = require('./diff')
55
const info = require('./info')
66

77
const fail = chalk.red('✖')
8-
const pass = chalk.green('✔')
98

109
function line(obj) {
1110
return obj.lineNum ? obj.lineNum : ''
@@ -19,14 +18,6 @@ function rpad(str, max) {
1918
return str
2019
}
2120

22-
function lpad(str, max) {
23-
const diff = max - str.length + 1
24-
if (diff > 0) {
25-
return `${' '.repeat(diff)}${str}`
26-
}
27-
return str
28-
}
29-
3021
function getInfo(s) {
3122
return rpad(info[s] || '', 40)
3223
}
@@ -37,7 +28,6 @@ exports.default = (obj, commit) => {
3728
? chalk.grey(rpad(`${line(obj)}:0`, 6))
3829
: rpad('', 6)
3930

40-
const str = obj.str
4131
const i = getInfo(obj.code)
4232

4333
return ` ${fail} ${lin} ${i} ${t}`
@@ -51,7 +41,6 @@ exports.ETITLETOOLONG = (obj, commit) => {
5141
const t = chalk.red('ETITLETOOLONG')
5242
const lin = chalk.grey(rpad(`${line(obj)}:50`, 6))
5343
const str = obj.str
54-
const l = str.length
5544
const i = getInfo('ETITLETOOLONG')
5645
return ` ${fail} ${lin} ${i} ${t}
5746
${diff.ETITLETOOLONG(str)}`
@@ -60,11 +49,9 @@ exports.ETITLETOOLONG = (obj, commit) => {
6049
exports.EINVALIDSUBSYSTEM = (obj, commit) => {
6150
const t = chalk.red('EINVALIDSUBSYSTEM')
6251
const title = commit.title
63-
const subs = commit.subsystems.join(',')
6452
const col = title.indexOf(obj.str)
6553
const lin = chalk.grey(rpad(`${line(obj)}:${col}`, 6))
6654
const str = obj.str
67-
const l = str.length
6855
const i = getInfo('EINVALIDSUBSYSTEM')
6956
return ` ${fail} ${lin} ${i} ${t}
7057
${diff.EINVALIDSUBSYSTEM(str, title)}`
@@ -74,7 +61,6 @@ exports.ELINETOOLONG = (obj, commit) => {
7461
const t = chalk.red('ELINETOOLONG')
7562
const lin = chalk.grey(rpad(`${line(obj)}:72`, 6))
7663
const str = obj.str
77-
const l = str.length
7864
const i = getInfo('ELINETOOLONG')
7965
return ` ${fail} ${lin} ${i} ${t}
8066
${diff.ELINETOOLONG(str)}`
@@ -109,6 +95,5 @@ exports.EMETAORDER = (obj, commit) => {
10995
const t = chalk.red('EMETAORDER')
11096
const lin = chalk.grey(rpad(`${line(obj)}:0`, 6))
11197
const i = getInfo('EMETAORDER')
112-
const str = obj.str
11398
return ` ${fail} ${lin} ${i} ${t}`
11499
}

test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ test('commit', (t) => {
6868
t.equal(c.date, 'Tue Mar 29 08:09:37 2016 -0500', 'date')
6969
t.deepEqual(c.subsystems, [], 'subsystems')
7070
t.equal(c.pr, 'https://github.com/nodejs/node/pull/5947', 'pr')
71-
t.equal(c.warnings.length, 1, 'warnings.length')
72-
t.equal(c.warnings[0].code, 'ETITLETOOLONG', 'code')
71+
t.equal(c.warnings.length, 0, 'warnings.length')
7372
t.equal(c.revert, true, 'revert')
7473

7574
c = new Commit(str3)

0 commit comments

Comments
 (0)