Skip to content

Conversation

@davidjgoss
Copy link
Contributor

@davidjgoss davidjgoss commented Apr 29, 2024

🤔 What's changed?

  • Add a new "formatter" kind of plugin (still internal)
  • Reimplement a couple of builtin formatters (html and message) as plugins and ensure they still work

The formatter plugin has a very lean interface for now - it can listen for messages, write to the output, and access the formatOptions from the configuration. The idea is to reimplement more builtin formatters and in doing so find and fill limitations, and probably also build out a useful test harness or pattern for people writing their own formatters.

So far we have only changes formatters that are not exported, to avoid any breaking changes and give us room to alter course if we need to in the short term. Next candidates for reimplementing will be:

  • junit (recently added, not exported)
  • json (because of make json formatter reusable outside cucumber-js #2239, will still export legacy version for a compatibility period)
  • progress-bar (not exported, needs direct access to the stream)
  • @cucumber/pretty-formatter (separate package, needs access to snippet syntax)

⚡️ What's your motivation?

Per #2091 we're working towards a plugin system, and that includes bring formatters into that with a leaner message-based interface.

🏷️ What kind of change is this?

  • 🏦 Refactoring/debt/DX (improvement to code design, tooling, etc. without changing behaviour)
  • ⚡ New feature (non-breaking change which adds new behaviour)

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

This text was originally generated from a template, then edited by hand. You can modify the template here.

@davidjgoss davidjgoss force-pushed the feat/new-formatter-part-1 branch from 15cb998 to 358abbb Compare April 29, 2024 07:55
@coveralls
Copy link

coveralls commented Apr 29, 2024

Coverage Status

coverage: 98.233% (-0.2%) from 98.402%
when pulling 8ff54d6 on feat/new-formatter-part-1
into 6dae044 on main.

const success = await runtime.start()
await cleanupFormatters()
await pluginManager.cleanup()
await cleanupFormatters()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaning up formatter streams should happen after formatter plugins have had a chance to do their own cleaning up.

@davidjgoss davidjgoss force-pushed the feat/new-formatter-part-1 branch from 968fe76 to ade5f14 Compare May 4, 2024 06:09
@davidjgoss davidjgoss changed the title WIP: Add formatter plugins and start reimplementing builtins Add formatter plugins and start reimplementing builtins May 4, 2024
@davidjgoss davidjgoss marked this pull request as ready for review May 4, 2024 06:16
@davidjgoss davidjgoss merged commit b02a90a into main May 4, 2024
@davidjgoss davidjgoss deleted the feat/new-formatter-part-1 branch May 4, 2024 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants