Skip to content

Commit

Permalink
Merge branch 'main' into 1648-replace-use-of-any
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwynne authored Jan 18, 2022
2 parents 3d1cd96 + aa1d65c commit 3e9d2bf
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 69 deletions.
34 changes: 16 additions & 18 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
extends:
- "eslint:recommended"
- "plugin:import/typescript"
- "plugin:@typescript-eslint/eslint-recommended"
- "plugin:@typescript-eslint/recommended"
- "plugin:prettier/recommended"
parser: "@typescript-eslint/parser"
- 'eslint:recommended'
- 'plugin:import/typescript'
- 'plugin:@typescript-eslint/eslint-recommended'
- 'plugin:@typescript-eslint/recommended'
- 'plugin:prettier/recommended'
- prettier
parser: '@typescript-eslint/parser'
parserOptions:
project: './tsconfig.json'
plugins:
- import
- node
- "@typescript-eslint"
- '@typescript-eslint'
- prettier
rules:
prettier/prettier:
- error
- trailingComma: es5
singleQuote: true
semi: false
'prettier/prettier': 2
# requires strictNullChecks compiler option, produces many errors with messages objects
"@typescript-eslint/strict-boolean-expressions": off
"@typescript-eslint/no-explicit-any": off
"@typescript-eslint/no-inferrable-types": off
"@typescript-eslint/no-empty-function": off
"@typescript-eslint/ban-types": off
"@typescript-eslint/no-unused-vars": off
'@typescript-eslint/strict-boolean-expressions': off
'@typescript-eslint/no-explicit-any': off
'@typescript-eslint/no-inferrable-types': off
'@typescript-eslint/no-empty-function': off
'@typescript-eslint/ban-types': off
'@typescript-eslint/no-unused-vars': off
8 changes: 7 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@

name: Build

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
Expand Down
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"trailingComma": "es5",
"singleQuote": true,
"semi": false
}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CONTRIBUTING.md) on how to contribute to Cucumber.

## [Unreleased]
### Changed
- Switch from `colors` to `chalk` for terminal coloring ([#1895](https://github.com/cucumber/cucumber-js/pull/1895))

## [8.0.0-rc.2] - 2022-01-10
### Added
Expand Down
4 changes: 2 additions & 2 deletions features/support/warn_user_about_enabling_developer_mode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { reindent } from 'reindent-template-literals'
import colors from 'colors/safe'
import chalk from 'chalk'

export function warnUserAboutEnablingDeveloperMode(error: any): void {
if (!(error?.code === 'EPERM')) {
Expand All @@ -10,7 +10,7 @@ export function warnUserAboutEnablingDeveloperMode(error: any): void {
}

console.error(
colors.red(
chalk.red(
reindent(`
Error: Unable to run feature tests!
Expand Down
4 changes: 2 additions & 2 deletions features/support/world.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { execFile } from 'child_process'
import { expect } from 'chai'
import toString from 'stream-to-string'
import { PassThrough, pipeline, Writable } from 'stream'
import colors from 'colors/safe'
import stripAnsi from 'strip-ansi'
import fs from 'fs'
import path from 'path'
import VError from 'verror'
Expand Down Expand Up @@ -122,7 +122,7 @@ export class World {
error: result.error,
errorOutput: result.stderr,
envelopes,
output: colors.strip(result.stdout),
output: stripAnsi(result.stdout),
}
this.verifiedLastRunError = false
expect(this.lastRun.output).to.not.include('Unhandled rejection')
Expand Down
37 changes: 14 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@
"@cucumber/tag-expressions": "4.1.0",
"assertion-error-formatter": "^3.0.0",
"capital-case": "^1.0.4",
"chalk": "^4.1.2",
"cli-table3": "0.6.1",
"colors": "1.4.0",
"commander": "^8.0.0",
"duration": "^0.2.2",
"durations": "^3.4.2",
Expand Down Expand Up @@ -263,6 +263,7 @@
"sinon-chai": "3.7.0",
"stream-buffers": "3.0.2",
"stream-to-string": "1.2.0",
"strip-ansi": "^6.0.1",
"ts-node": "10.4.0",
"tsd": "0.19.1",
"typescript": "4.5.4"
Expand Down
12 changes: 6 additions & 6 deletions src/cli/publish_banner.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import colors from 'colors/safe'
import chalk from 'chalk'
import Table from 'cli-table3'

const underlineBoldCyan = (x: string): string =>
colors.underline(colors.bold(colors.cyan(x)))
chalk.underline(chalk.bold(chalk.cyan(x)))

const formattedReportUrl = underlineBoldCyan('https://reports.cucumber.io')
const formattedEnv =
colors.cyan('CUCUMBER_PUBLISH_ENABLED') + '=' + colors.cyan('true')
chalk.cyan('CUCUMBER_PUBLISH_ENABLED') + '=' + chalk.cyan('true')
const formattedMoreInfoUrl = underlineBoldCyan(
'https://cucumber.io/docs/cucumber/environment-variables/'
)

const text = `\
Share your Cucumber Report with your team at ${formattedReportUrl}
Command line option: ${colors.cyan('--publish')}
Command line option: ${chalk.cyan('--publish')}
Environment variable: ${formattedEnv}
More information at ${formattedMoreInfoUrl}
To disable this message, add this to your ${colors.bold('./cucumber.js')}:
${colors.bold("module.exports = { default: '--publish-quiet' }")}`
To disable this message, add this to your ${chalk.bold('./cucumber.js')}:
${chalk.bold("module.exports = { default: '--publish-quiet' }")}`

const table = new Table({
style: {
Expand Down
30 changes: 14 additions & 16 deletions src/formatter/get_color_fns.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import colors from 'colors/safe'
import chalk from 'chalk'
import { TestStepResultStatus } from '@cucumber/messages'

colors.enable()

export type IColorFn = (text: string) => string

export interface IColorFns {
Expand All @@ -20,21 +18,21 @@ export default function getColorFns(enabled: boolean): IColorFns {
return {
forStatus(status: TestStepResultStatus) {
return {
AMBIGUOUS: colors.red.bind(colors),
FAILED: colors.red.bind(colors),
PASSED: colors.green.bind(colors),
PENDING: colors.yellow.bind(colors),
SKIPPED: colors.cyan.bind(colors),
UNDEFINED: colors.yellow.bind(colors),
UNKNOWN: colors.yellow.bind(colors),
AMBIGUOUS: chalk.red.bind(chalk),
FAILED: chalk.red.bind(chalk),
PASSED: chalk.green.bind(chalk),
PENDING: chalk.yellow.bind(chalk),
SKIPPED: chalk.cyan.bind(chalk),
UNDEFINED: chalk.yellow.bind(chalk),
UNKNOWN: chalk.yellow.bind(chalk),
}[status]
},
location: colors.gray.bind(colors),
tag: colors.cyan.bind(colors),
diffAdded: colors.green.bind(colors),
diffRemoved: colors.red.bind(colors),
errorMessage: colors.red.bind(colors),
errorStack: colors.grey.bind(colors),
location: chalk.gray.bind(chalk),
tag: chalk.cyan.bind(chalk),
diffAdded: chalk.green.bind(chalk),
diffRemoved: chalk.red.bind(chalk),
errorMessage: chalk.red.bind(chalk),
errorStack: chalk.grey.bind(chalk),
}
} else {
return {
Expand Down

0 comments on commit 3e9d2bf

Please sign in to comment.