Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature proposal: enhance expectations so that they show similar to mocha runner #112

Open
SgtPooki opened this issue Jun 16, 2022 · 2 comments

Comments

@SgtPooki
Copy link
Member

SgtPooki commented Jun 16, 2022

Mocha shows failures in a very easy to read format where each expectation shows the following:

  1. expected result
  2. actual result
  3. difference

3 could be challenging, but it should be trivial to update the expectation code to show the expected value and actual value given a particular path. Something like this for an expectation would be nice:

interface Expectation<T> {
  message?: (expected, actual) => string
  expectedValue: T,
  pathToActual: string[]
}

where

  • Expectation['message'] would default to
const defaultFailureMsg = `Expected ${expected} but received ${actual} at path ${pathToActual}`

on failure and

const defaultSuccessMsg = `Correctly received expected value of ${expected} at path ${pathToActual}`
@SgtPooki
Copy link
Member Author

Thoughts @lidel? @hacdias?

@SgtPooki
Copy link
Member Author

Played with some type adjustments for this on https://github.com/ipfs-shipyard/pinning-service-compliance/tree/upgrade-expectations

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

No branches or pull requests

1 participant