Skip to content

Commit

Permalink
chore: add parallel coverage generation; linting (#157)
Browse files Browse the repository at this point in the history
* refactor: lint with standard

Result of running `standard --fix` with latest version of standard

* ci: add latest lts node version to matrix

* ci: add parallel coverage generation

* chore(scripts): sort alphabetically ascending order

* chore(lib): correct param type
  • Loading branch information
Fdawgs committed Feb 19, 2021
1 parent fb6f984 commit 21544cb
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 15 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 13.x]
node-version: [10.x, 12.x, 13.x, 14.x]
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
Expand All @@ -30,6 +30,22 @@ jobs:
run: npm install
- name: Run Tests
run: npm run ci
- name: Coveralls Parallel
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.github_token }}
parallel: true
flag-name: run-${{ matrix.node-version }}-${{ matrix.os }}

coverage:
needs: build
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

automerge:
needs: build
Expand Down
2 changes: 1 addition & 1 deletion lib/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ coloredColorizer.message = colored.message
* Factory function get a function to colorized levels. The returned function
* also includes a `.message(str)` method to colorize strings.
*
* @param {bool} [useColors=false] When `true` a function that applies standard
* @param {boolean} [useColors=false] When `true` a function that applies standard
* terminal colors is returned.
*
* @returns {function} `function (level) {}` has a `.message(str)` method to
Expand Down
12 changes: 6 additions & 6 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports.internals = {
*
* @param {number|string} epoch The time to convert. May be any value that is
* valid for `new Date()`.
* @param {bool|string} [translateTime=false] When `false`, the given `epoch`
* @param {boolean|string} [translateTime=false] When `false`, the given `epoch`
* will simply be returned. When `true`, the given `epoch` will be converted
* to a string at UTC using the `DATE_FORMAT` constant. If `translateTime` is
* a string, the following rules are available:
Expand Down Expand Up @@ -97,7 +97,7 @@ function isObject (input) {
*/
function joinLinesWithIndentation ({ input, ident = ' ', eol = '\n' }) {
const lines = input.split(/\r?\n/)
for (var i = 1; i < lines.length; i += 1) {
for (let i = 1; i < lines.length; i += 1) {
lines[i] = ident + lines[i]
}
return lines.join(eol)
Expand Down Expand Up @@ -146,7 +146,7 @@ function prettifyErrorLog ({
propertiesToPrint = errorProperties.filter(k => excludeProperties.includes(k) === false)
}

for (var i = 0; i < propertiesToPrint.length; i += 1) {
for (let i = 0; i < propertiesToPrint.length; i += 1) {
const key = propertiesToPrint[i]
if (key in log === false) continue
if (isObject(log[key])) {
Expand Down Expand Up @@ -312,7 +312,7 @@ function prettifyObject ({
let result = ''

const keysToIterate = objectKeys.filter(k => keysToIgnore.includes(k) === false)
for (var i = 0; i < objectKeys.length; i += 1) {
for (let i = 0; i < objectKeys.length; i += 1) {
const keyName = keysToIterate[i]
const keyValue = input[keyName]

Expand All @@ -330,7 +330,7 @@ function prettifyObject ({

if (errorLikeKeys.includes(keyName) === true) {
const splitLines = `${ident}${keyName}: ${joinedLines}${eol}`.split(eol)
for (var j = 0; j < splitLines.length; j += 1) {
for (let j = 0; j < splitLines.length; j += 1) {
if (j !== 0) result += eol

const line = splitLines[j]
Expand Down Expand Up @@ -362,7 +362,7 @@ function prettifyObject ({
* @param {object} input
* @param {object} input.log The log object with the timestamp to be prettified.
* @param {string} [input.timestampKey='time'] The log property that should be used to resolve timestamp value
* @param {bool|string} [input.translateFormat=undefined] When `true` the
* @param {boolean|string} [input.translateFormat=undefined] When `true` the
* timestamp will be prettified into a string at UTC using the default
* `DATE_FORMAT`. If a string, then `translateFormat` will be used as the format
* string to determine the output; see the `formatTime` function for details.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"pino-pretty": "./bin.js"
},
"scripts": {
"ci": "standard && tap 'test/**/*.test.js' --coverage-report=lcovonly",
"lint": "standard | snazzy",
"test": "tap --100 'test/**/*.test.js'",
"ci": "standard && tap --100 'test/**/*.test.js'"
"test": "tap --100 'test/**/*.test.js'"
},
"repository": {
"type": "git",
Expand Down
6 changes: 3 additions & 3 deletions test/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ test('basic prettifier tests', (t) => {
const lines = formatted.split('\n')
t.is(lines.length, expectedLines.length + 2)
lines.shift(); lines.pop()
for (var i = 0; i < lines.length; i += 1) {
for (let i = 0; i < lines.length; i += 1) {
t.is(lines[i], expectedLines[i])
}
cb()
Expand Down Expand Up @@ -513,7 +513,7 @@ test('basic prettifier tests', (t) => {
const lines = formatted.split('\n')
t.is(lines.length, expectedLines.length + 2)
lines.shift(); lines.pop()
for (var i = 0; i < lines.length; i += 1) {
for (let i = 0; i < lines.length; i += 1) {
t.is(lines[i], expectedLines[i])
}
cb()
Expand All @@ -539,7 +539,7 @@ test('basic prettifier tests', (t) => {
const lines = formatted.split('\n')
t.is(lines.length, expectedLines.length + 2)
lines.shift(); lines.pop()
for (var i = 0; i < lines.length; i += 1) {
for (let i = 0; i < lines.length; i += 1) {
t.is(lines[i], expectedLines[i])
}
cb()
Expand Down
4 changes: 2 additions & 2 deletions test/error-objects.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ test('error like objects tests', (t) => {
const formatted = pretty(chunk.toString())
const lines = formatted.split('\n')
lines.shift(); lines.pop()
for (var i = 0; i < lines.length; i += 1) {
for (let i = 0; i < lines.length; i += 1) {
t.is(lines[i], expectedLines[i])
}
cb()
Expand Down Expand Up @@ -244,7 +244,7 @@ test('error like objects tests', (t) => {
const formatted = pretty(chunk.toString())
const lines = formatted.split('\n')
lines.shift(); lines.pop()
for (var i = 0; i < lines.length; i += 1) {
for (let i = 0; i < lines.length; i += 1) {
t.true(expectedLines.includes(lines[i]))
}
cb()
Expand Down

0 comments on commit 21544cb

Please sign in to comment.