Skip to content

Commit

Permalink
bump deps and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
liyu1981 committed Oct 24, 2024
1 parent d3d7304 commit b29bf77
Show file tree
Hide file tree
Showing 37 changed files with 8,291 additions and 7,984 deletions.
15,443 changes: 8,086 additions & 7,357 deletions package-lock.json

Large diffs are not rendered by default.

55 changes: 28 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,34 @@
"test": "ava && tsd"
},
"dependencies": {
"minimist": "^1.2.0"
"minimist": "^1.2.8"
},
"devDependencies": {
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.0.0",
"@types/node": "^12.0.0",
"ava": "^2.4.0",
"bops": "^1.0.0",
"chalk": "^2.4.2",
"concat-stream": "^2.0.0",
"csv-spectrum": "^1.0.0",
"eslint": "^6.4.0",
"eslint-config-standard": "^14.1.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.1.1",
"eslint-plugin-standard": "^4.0.0",
"execa": "^2.1.0",
"globby": "^10.0.1",
"husky": "^3.0.0",
"lint-staged": "^9.0.2",
"loud-rejection": "^2.1.0",
"nyc": "^14.1.1",
"pre-commit": "^1.2.2",
"strip-ansi": "^5.2.0",
"text-table": "^0.2.0",
"time-span": "^3.1.0",
"tsd": "^0.8.0"
"@commitlint/cli": "19.5.0",
"@commitlint/config-conventional": "19.5.0",
"@types/node": "22.7.9",
"ava": "6.1.3",
"bops": "1.0.1",
"chalk": "5.3.0",
"concat-stream": "2.0.0",
"csv-spectrum": "2.0.0",
"eslint": "9.13.0",
"eslint-config-standard": "14.1.0",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "7.1.0",
"eslint-plugin-standard": "5.0.0",
"execa": "2.1.0",
"globby": "14.0.2",
"husky": "9.1.6",
"lint-staged": "15.2.10",
"loud-rejection": "2.2.0",
"nyc": "17.1.0",
"pre-commit": "1.2.2",
"strip-ansi": "7.1.0",
"text-table": "0.2.0",
"time-span": "5.1.0",
"tsd": "0.31.2"
},
"directories": {
"example": "examples",
Expand All @@ -75,7 +75,8 @@
"files": [
"!**/fixtures/**",
"!**/helpers/**"
]
],
"failWithoutAssertions": false
},
"husky": {
"hooks": {
Expand Down
4 changes: 2 additions & 2 deletions test/escape.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ const test = require('ava')

const { collect } = require('./helpers/helper')

test.cb('headers: false, numeric column names', (t) => {
test('headers: false, numeric column names', (t) => {
const verify = (err, lines) => {
t.false(err, 'no err')
t.snapshot(lines, 'lines')
t.is(lines.length, 2, '2 rows')
t.end()
t.pass()
}

collect('basic', { headers: false }, verify)
Expand Down
12 changes: 6 additions & 6 deletions test/headers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@ const test = require('ava')

const { collect } = require('./helpers/helper')

test.cb('custom escape character', (t) => {
test('custom escape character', (t) => {
const verify = (err, lines) => {
t.false(err, 'no err')
t.snapshot(lines[0], 'first row')
t.snapshot(lines[1], 'second row')
t.snapshot(lines[2], 'third row')
t.is(lines.length, 3, '3 rows')
t.end()
t.pass()
}

collect('option-escape', { escape: '\\' }, verify)
})

test.cb('headers: false', (t) => {
test('headers: false', (t) => {
const verify = (err, lines) => {
t.false(err, 'no err')
t.snapshot(lines)
t.end()
t.pass()
}

collect('no-headers', { headers: false }, verify)
})

test.cb('headers option', (t) => {
test('headers option', (t) => {
const verify = (err, lines) => {
t.false(err, 'no err')
t.snapshot(lines)
t.end()
t.pass()
}

collect('headers', { headers: ['a', 'b', 'c'] }, verify)
Expand Down
8 changes: 4 additions & 4 deletions test/issues.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ const test = require('ava')

const { collect } = require('./helpers/helper')

test.cb('backtick separator (#105)', (t) => {
test('backtick separator (#105)', (t) => {
const verify = (err, lines) => {
t.false(err, 'no err')
t.snapshot(lines, 'lines')
t.is(lines.length, 2, '2 rows')
t.end()
t.pass()
}

collect('backtick', { separator: '`' }, verify)
})

test.cb('strict + skipLines (#136)', (t) => {
test('strict + skipLines (#136)', (t) => {
const verify = (err, lines) => {
t.false(err, 'no err')
t.snapshot(lines, 'lines')
t.is(lines.length, 3, '4 rows')
t.end()
t.pass()
}

collect('strict+skipLines', { strict: true, skipLines: 1 }, verify)
Expand Down
8 changes: 4 additions & 4 deletions test/mapHeaders.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const test = require('ava')

const { collect } = require('./helpers/helper')

test.cb('rename columns', (t) => {
test('rename columns', (t) => {
const headers = { a: 'x', b: 'y', c: 'z' }
const mapHeaders = ({ header, index }) => {
return headers[header]
Expand All @@ -11,13 +11,13 @@ test.cb('rename columns', (t) => {
t.false(err, 'no err')
t.snapshot(lines[0], 'first row')
t.is(lines.length, 1, '1 row')
t.end()
t.pass()
}

collect('basic', { mapHeaders }, verify)
})

test.cb('skip columns a and c', (t) => {
test('skip columns a and c', (t) => {
const mapHeaders = ({ header, index }) => {
if (['a', 'c'].indexOf(header) > -1) {
return null
Expand All @@ -29,7 +29,7 @@ test.cb('skip columns a and c', (t) => {
t.false(err, 'no err')
t.snapshot(lines[0], 'first row')
t.is(lines.length, 1, '1 row')
t.end()
t.pass()
}

collect('basic', { mapHeaders }, verify)
Expand Down
8 changes: 4 additions & 4 deletions test/mapValues.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const test = require('ava')

const { collect } = require('./helpers/helper')

test.cb('map values', (t) => {
test('map values', (t) => {
const headers = []
const indexes = []
const mapValues = ({ header, index, value }) => {
Expand All @@ -17,13 +17,13 @@ test.cb('map values', (t) => {
t.is(lines.length, 1, '1 row')
t.snapshot(headers, 'headers')
t.snapshot(indexes, 'indexes')
t.end()
t.pass()
}

collect('basic', { mapValues }, verify)
})

test.cb('map last empty value', (t) => {
test('map last empty value', (t) => {
const mapValues = ({ value }) => {
return value === '' ? null : value
}
Expand All @@ -33,7 +33,7 @@ test.cb('map last empty value', (t) => {
t.is(lines.length, 2, '2 rows')
t.is(lines[0].name, null, 'name is mapped')
t.is(lines[0].location, null, 'last value mapped')
t.end()
t.pass()
}

collect('empty-columns', { mapValues, headers: ['date', 'name', 'location'] }, verify)
Expand Down
4 changes: 2 additions & 2 deletions test/maxRowBytes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ const test = require('ava')

const { collect } = require('./helpers/helper')

test.cb('maxRowBytes', (t) => {
test('maxRowBytes', (t) => {
const verify = (err, lines) => {
t.is(err.message, 'Row exceeds the maximum size', 'strict row size')
t.is(lines.length, 4576, '4576 rows before error')
t.end()
t.pass()
}

collect('option-maxRowBytes', { maxRowBytes: 200 }, verify)
Expand Down
4 changes: 2 additions & 2 deletions test/newline.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ const test = require('ava')

const { collect } = require('./helpers/helper')

test.cb('newline', (t) => {
test('newline', (t) => {
const verify = (err, lines) => {
t.false(err, 'no err')
t.snapshot(lines[0], 'first row')
t.snapshot(lines[1], 'second row')
t.snapshot(lines[2], 'third row')
t.is(lines.length, 3, '3 rows')
t.end()
t.pass()
}

collect('option-newline', { newline: 'X' }, verify)
Expand Down
12 changes: 6 additions & 6 deletions test/quote.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@ const test = require('ava')

const { collect } = require('./helpers/helper')

test.cb('custom quote character', (t) => {
test('custom quote character', (t) => {
const verify = (err, lines) => {
t.false(err, 'no err')
t.snapshot(lines[0], 'first row')
t.snapshot(lines[1], 'second row')
t.is(lines.length, 2, '2 rows')
t.end()
t.pass()
}

collect('option-quote', { quote: "'" }, verify)
})

test.cb('custom quote and escape character', (t) => {
test('custom quote and escape character', (t) => {
const verify = (err, lines) => {
t.false(err, 'no err')
t.snapshot(lines[0], 'first row')
t.snapshot(lines[1], 'second row')
t.snapshot(lines[2], 'third row')
t.is(lines.length, 3, '3 rows')
t.end()
t.pass()
}

collect('option-quote-escape', { quote: "'", escape: '\\' }, verify)
})

test.cb('quote many', (t) => {
test('quote many', (t) => {
const verify = (err, lines) => {
t.false(err, 'no err')
t.snapshot(lines[0], 'first row')
t.snapshot(lines[1], 'second row')
t.snapshot(lines[2], 'third row')
t.is(lines.length, 3, '3 rows')
t.end()
t.pass()
}

collect('option-quote-many', { quote: "'" }, verify)
Expand Down
8 changes: 4 additions & 4 deletions test/skipComments.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ const test = require('ava')

const { collect } = require('./helpers/helper')

test.cb('comment', (t) => {
test('comment', (t) => {
const verify = (err, lines) => {
t.false(err, 'no err')
t.snapshot(lines)
t.is(lines.length, 1, '1 row')
t.end()
t.pass()
}

collect('comment', { skipComments: true }, verify)
})

test.cb('custom comment', (t) => {
test('custom comment', (t) => {
const verify = (err, lines) => {
t.false(err, 'no err')
t.snapshot(lines)
t.is(lines.length, 1, '1 row')
t.end()
t.pass()
}

collect('option-comment', { skipComments: '~' }, verify)
Expand Down
8 changes: 4 additions & 4 deletions test/skipLines.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ const test = require('ava')

const { collect } = require('./helpers/helper')

test.cb('skip lines', (t) => {
test('skip lines', (t) => {
const verify = (err, lines) => {
t.false(err, 'no err')
t.is(lines.length, 1, '1 row')
t.is(JSON.stringify(lines[0]), JSON.stringify({ yes: 'ok', yup: 'ok', yeah: 'ok!' }))
t.end()
t.pass()
}

collect('bad-data', { skipLines: 2 }, verify)
})

test.cb('skip lines with headers', (t) => {
test('skip lines with headers', (t) => {
const verify = (err, lines) => {
t.false(err, 'no err')
t.is(lines.length, 2, '2 rows')
t.is(JSON.stringify(lines[0]), JSON.stringify({ s: 'yes', p: 'yup', h: 'yeah' }))
t.is(JSON.stringify(lines[1]), JSON.stringify({ s: 'ok', p: 'ok', h: 'ok!' }))
t.end()
t.pass()
}

collect('bad-data', { headers: ['s', 'p', 'h'], skipLines: 2 }, verify)
Expand Down
22 changes: 0 additions & 22 deletions test/snapshots/escape.test.js.md

This file was deleted.

Binary file removed test/snapshots/escape.test.js.snap
Binary file not shown.
Loading

0 comments on commit b29bf77

Please sign in to comment.