<commit_before>import 'should'

import { run } from './exec'

describe('Color', () => {
  const runColored = (fileName: string, name?: string) =>
    run(fileName, { colorsEnabled: true, '--name': name })

  it('should color feature keywords', () => {
    runColored('feature.feature', 'Feature name').should.containEql(
      '\u001b[34m\u001b[1mFeature:\u001b[22m\u001b[39m Feature\n'
    )
  })

  it('should color rule keywords', () => {
    runColored('rule.feature').should.containEql(
      '  \u001b[34m\u001b[1mRule:\u001b[22m\u001b[39m first rule\n'
    )
  })

  it('should color scenario keywords', () => {
    runColored('scenario.feature', 'Scenario name').should.containEql(
      '\u001b[36mScenario:\u001b[39m Scenario name\n'
    )
  })

  it('should color step keywords', () => {
    runColored('step.feature', 'Step name').should.containEql(
      '    \u001b[36m\u001b[1mGiven\u001b[22m\u001b[39m noop\n' +
        '    \u001b[36m\u001b[1mWhen\u001b[22m\u001b[39m noop\n' +
        '    \u001b[36m\u001b[1mThen\u001b[22m\u001b[39m noop\n'
    )
  })

  it('should color ambiguous steps', () => {
    runColored('step.feature', 'Ambiguous step').should.containEql(
      '    \u001b[31m✖ ambiguous\u001b[39m\n'
    )
  })

  it('should color failed steps', () => {
    runColored('step.feature', 'Failed step').should.containEql(
      '    \u001b[31m✖ failed\u001b[39m\n'
    )
  })

  it('should color pending steps', () => {
    runColored('step.feature', 'Pending step').should.containEql(
      '    \u001b[33m? pending\u001b[39m\n'
    )
  })

  it('should color skipped steps', () => {
    runColored('step.feature', 'Skipped step').should.containEql(
      '    \u001b[36m- skipped\u001b[39m\n'
    )
  })

  it('should color undefined steps', () => {
    runColored('step.feature', 'Undefined step').should.containEql(
      '    \u001b[33m? undefined\u001b[39m\n'
    )
  })

  it('should color errors', () => {
    runColored('step.feature', 'Failed step').should.containEql(
      '    \u001b[31mError: FAILED'
    )
  })

  it('should color feature tags', () => {
    runColored('tag.feature', 'Feature tag').should.containEql(
      '\u001b[36m@feature @tag\u001b[39m\n'
    )
  })

  it('should color scenario tags', () => {
    runColored('tag.feature', 'Scenario tag').should.containEql(
      '\u001b[36m@feature @tag @scenario\u001b[39m\n'<commit_msg>Rely on styleText in tests<commit_after>import 'should'

import { run } from './exec'
import { styleText, TextStyle } from '../src/styleText'

describe('Color', () => {
  const runColored = (fileName: string, name?: string) =>
    run(fileName, { colorsEnabled: true, '--name': name })

  it('colors feature keywords', () => {
    runColored('feature.feature', 'Feature name').should.containEql(
      styleText('Feature:', 'blue', 'bold')
    )
  })

  it('colors rule keywords', () => {
    runColored('rule.feature').should.containEql(
      `  ${styleText('Rule:', 'blue', 'bold')} first rule\n`
    )
  })

  it('colors scenario keywords', () => {
    runColored('scenario.feature', 'Scenario name').should.containEql(
      `${styleText('Scenario:', 'cyan')} Scenario name\n`
    )
  })

  it('colors step keywords', () => {
    const stepStyles: TextStyle[] = ['cyan', 'bold']
    runColored('step.feature', 'Step name').should.containEql(
      `    ${styleText('Given', ...stepStyles)} noop\n` +
        `    ${styleText('When', ...stepStyles)} noop\n` +
        `    ${styleText('Then', ...stepStyles)} noop\n`
    )
  })

  it('colors ambiguous steps', () => {
    runColored('step.feature', 'Ambiguous step').should.containEql(
      `    ${styleText('✖ ambiguous', 'red')}\n`
    )
  })

  it('colors failed steps', () => {
    runColored('step.feature', 'Failed step').should.containEql(
      `    ${styleText('✖ failed', 'red')}\n`
    )
  })

  it('colors pending steps', () => {
    runColored('step.feature', 'Pending step').should.containEql(
      `    ${styleText('? pending', 'yellow')}\n`
    )
  })

  it('colors undefined steps', () => {
    runColored('step.feature', 'Undefined step').should.containEql(
      `    ${styleText('? undefined', 'yellow')}\n`
    )
  })

  it('colors skipped steps', () => {
    runColored('step.feature', 'Skipped step').should.containEql(
      `    ${styleText('- skipped', 'cyan')}\n`
    )
  })

  it('colors errors', () => {
    runColored('step.feature', 'Failed step').should.containEql(
      `    ${styleText('Error: FAILED', 'red')}`
    )
  })

  it('colors feature tags', () => {
    runColored('tag.feature', 'Feature tag').should.containEql(
      `${styleText('@feature @tag', 'cyan')}\n`
    )
  })

  it('colors scenario tags', () => {
    runColored('tag.feature', 'Scenario tag').should.containEql(
      `${styleText('@feature @tag @scenario', 'cyan')}\n`
{'fraction_non_alphanumeric': 0.20169983416252074, 'fraction_numerical': 0.03731343283582089, 'mean_word_length': 3.2102966841186737, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6300188', 'n_tokens_mistral': 1894, 'n_tokens_neox': 1763, 'n_words': 276}