mirror of
https://github.com/iptv-org/database.git
synced 2024-11-24 19:51:25 -05:00
Fixes wrong line number in logs
This commit is contained in:
parent
1ea89eded0
commit
ae2231547d
6 changed files with 24 additions and 18 deletions
14
package-lock.json
generated
14
package-lock.json
generated
|
@ -6,7 +6,7 @@
|
|||
"": {
|
||||
"name": "@iptv-org/database",
|
||||
"dependencies": {
|
||||
"@freearhey/core": "^0.2.1",
|
||||
"@freearhey/core": "^0.2.2",
|
||||
"@joi/date": "^2.1.0",
|
||||
"@json2csv/formatters": "^7.0.3",
|
||||
"@json2csv/node": "^7.0.3",
|
||||
|
@ -798,9 +798,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@freearhey/core": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@freearhey/core/-/core-0.2.1.tgz",
|
||||
"integrity": "sha512-kEdIxZClykKhGpgyCSlkwuVuSCCAWr3J5YvOUMJQDPgVAYvT5VbD8MYKPm+OwNi9T4HFmF6qqY90qwKJPoOXCA==",
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@freearhey/core/-/core-0.2.2.tgz",
|
||||
"integrity": "sha512-8eikSh+alXohY/0Qv8lls+6BG738vOqxGuLvMjwBasbwuz8S/Abr7fUAH65dGjPAsB3HMaDhjK5c6kcVz5GrcA==",
|
||||
"dependencies": {
|
||||
"@types/fs-extra": "^11.0.2",
|
||||
"@types/lodash": "^4.14.198",
|
||||
|
@ -6552,9 +6552,9 @@
|
|||
"integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ=="
|
||||
},
|
||||
"@freearhey/core": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@freearhey/core/-/core-0.2.1.tgz",
|
||||
"integrity": "sha512-kEdIxZClykKhGpgyCSlkwuVuSCCAWr3J5YvOUMJQDPgVAYvT5VbD8MYKPm+OwNi9T4HFmF6qqY90qwKJPoOXCA==",
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@freearhey/core/-/core-0.2.2.tgz",
|
||||
"integrity": "sha512-8eikSh+alXohY/0Qv8lls+6BG738vOqxGuLvMjwBasbwuz8S/Abr7fUAH65dGjPAsB3HMaDhjK5c6kcVz5GrcA==",
|
||||
"requires": {
|
||||
"@types/fs-extra": "^11.0.2",
|
||||
"@types/lodash": "^4.14.198",
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
"testRegex": "tests/(.*?/)?.*test.(js|ts)$"
|
||||
},
|
||||
"dependencies": {
|
||||
"@freearhey/core": "^0.2.1",
|
||||
"@freearhey/core": "^0.2.2",
|
||||
"@joi/date": "^2.1.0",
|
||||
"@json2csv/formatters": "^7.0.3",
|
||||
"@json2csv/node": "^7.0.3",
|
||||
|
|
|
@ -129,11 +129,11 @@ async function main() {
|
|||
}
|
||||
|
||||
const schema = Joi.object(schemes[filename])
|
||||
rows.forEach((row: string | string[] | boolean, i: number) => {
|
||||
rows.all().forEach((row: { [key: string]: string }, i: number) => {
|
||||
const { error } = schema.validate(row, { abortEarly: false })
|
||||
if (error) {
|
||||
error.details.forEach(detail => {
|
||||
fileErrors.push({ line: i + 2, message: detail.message })
|
||||
fileErrors.push({ line: i + 2, row, message: detail.message })
|
||||
})
|
||||
}
|
||||
})
|
||||
|
@ -142,7 +142,8 @@ async function main() {
|
|||
logger.info(`\n${chalk.underline(filepath)}`)
|
||||
fileErrors.forEach(err => {
|
||||
const position = err.line.toString().padEnd(6, ' ')
|
||||
logger.info(` ${chalk.gray(position)} ${err.message}`)
|
||||
const id = err.row && err.row.id ? ` ${err.row.id}:` : ''
|
||||
logger.info(` ${chalk.gray(position)}${id} ${err.message}`)
|
||||
})
|
||||
globalErrors = globalErrors.concat(fileErrors)
|
||||
}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
id,name,alt_names,network,owners,country,subdivision,city,broadcast_area,languages,categories,is_nsfw,launched,closed,replaced_by,website,logo
|
||||
002RadioTV.do,002 Radio TV,,,,DO,,,c/DO,spa,,FALSE,,,,https://www.002radio.com/,https://i.imgur.com/7oNe8xj.png
|
||||
002RadioTV.do,002 Radio TV,,,,DO,,,c/DO,spa,,FALSE,,,,ttps://www.002radio.com/,https://i.imgur.com/7oNe8xj.png
|
|
|
@ -68,8 +68,13 @@ describe('db:validate', () => {
|
|||
process.exit(1)
|
||||
} catch (error) {
|
||||
expect((error as ExecError).status).toBe(1)
|
||||
expect((error as ExecError).stdout).toContain('"aaa.us" is missing in the channels.csv')
|
||||
expect((error as ExecError).stdout).toContain('1 error(s)')
|
||||
expect((error as ExecError).stdout).toContain(
|
||||
'2 "aaa.us" is missing in the channels.csv'
|
||||
)
|
||||
expect((error as ExecError).stdout).toContain(
|
||||
'2 002RadioTV.do: "website" must be a valid uri with a scheme matching the http|https pattern'
|
||||
)
|
||||
expect((error as ExecError).stdout).toContain('2 error(s)')
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -341,10 +341,10 @@
|
|||
resolved "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz"
|
||||
integrity sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==
|
||||
|
||||
"@freearhey/core@^0.2.1":
|
||||
version "0.2.1"
|
||||
resolved "https://registry.npmjs.org/@freearhey/core/-/core-0.2.1.tgz"
|
||||
integrity sha512-kEdIxZClykKhGpgyCSlkwuVuSCCAWr3J5YvOUMJQDPgVAYvT5VbD8MYKPm+OwNi9T4HFmF6qqY90qwKJPoOXCA==
|
||||
"@freearhey/core@^0.2.2":
|
||||
version "0.2.2"
|
||||
resolved "https://registry.npmjs.org/@freearhey/core/-/core-0.2.2.tgz"
|
||||
integrity sha512-8eikSh+alXohY/0Qv8lls+6BG738vOqxGuLvMjwBasbwuz8S/Abr7fUAH65dGjPAsB3HMaDhjK5c6kcVz5GrcA==
|
||||
dependencies:
|
||||
"@types/fs-extra" "^11.0.2"
|
||||
"@types/lodash" "^4.14.198"
|
||||
|
|
Loading…
Reference in a new issue