jest-expect-message icon indicating copy to clipboard operation
jest-expect-message copied to clipboard

⚠️ This package appears to be abandoned.

Open golergka opened this issue 2 years ago • 3 comments

Most importantly — this is not an attack on @mattphillips. Nobody's entitled to other person's labour, and open source maintainer "is not my bitch". If he made a decision to abandon this package, it's his to make.

That said, if you plan to use this package, you should be aware that it has last been updated in 2019, and critical issues like https://github.com/mattphillips/jest-expect-message/issues/39 that prevent it from being used with new versions of Jest are not fixed, and pull request that fixes that https://github.com/mattphillips/jest-expect-message/issues/39 has been open for almost two years.

If anyone would fork this package, merge all the pull requests and release it on npm under another name, however, this would be most welcome.

golergka avatar May 10 '22 10:05 golergka

try modified package @alex_neo/jest-expect-message connect to project as

 setupFilesAfterEnv: ['@alex_neo/jest-expect-message'],

alexneo2003 avatar May 10 '22 10:05 alexneo2003

I also made my own version of the package jest-27-expect-message

It has Jest 27 support and the dependency versions have been bumped. I can look into merging other PRs into this package in the upcoming week.

EDIT: I've started merging PRs from this repo to my new package. Notably, this PR with performance improvements is now included in my package: https://github.com/mattphillips/jest-expect-message/pull/27

HumbertoL avatar May 16 '22 14:05 HumbertoL

Can you guys add this file to your repos?

/types/jest-expect-message.d.ts

declare namespace jest {
  interface Expect {
    <T = unknown>(actual: T, failMessage: string): JestMatchers<T>;
  }
}

This is so that typescript projects could use it.

mctrafik avatar Jun 22 '22 01:06 mctrafik

The main reason why this package has been abandonned is that it is useless.

The rare cases where you need some result text to be linked with the test, you just need to throw the message, and jest will format it well for you.

if ( expect_condition )
  throw new Error( myMessage );

The good practice is to keep original expect functions in order to force decomposition with many expect( .. ) calls. But for those that are used to some other test framework, that feature could be missing.

Anthony-Breneliere avatar Sep 08 '22 10:09 Anthony-Breneliere

The main reason why this package has been abandonned is that it is useless.

Even if it was true, it would be completely irrelevant. There's a lot of projects in production that, for better or worse, have already made a decision to use this package, and these projects need to be able to upgrade to the latest Jest versions without needing to rewrite all their tests for something else.

golergka avatar Sep 08 '22 10:09 golergka

Even if it was true, it would be completely irrelevant. There's a lot of projects in production that, for better or worse, have already made a decision to use this package, and these projects need to be able to upgrade to the latest Jest versions without needing to rewrite all their tests for something else.

Yes you are right, I forgot that who integrated it before. Maybe open source projects should have a kind of guarantor, to delegate the maintenance after a abandonment.

Anthony-Breneliere avatar Sep 08 '22 14:09 Anthony-Breneliere

Thanks for your messages, this package isn't abandoned. I've just published https://www.npmjs.com/package/jest-expect-message/v/1.0.4 which includes fixes for #39 and #24 and #34.

I'll go ahead and close this issue 👍

mattphillips avatar Sep 08 '22 17:09 mattphillips

Thanks for your messages, this package isn't abandoned. I've just published https://www.npmjs.com/package/jest-expect-message/v/1.0.4 which includes fixes for #39 and #24 and #34.

I'll go ahead and close this issue 👍

It is a surprise, after 4 years !

I just reverted the commit that added jest-expect-message on my current project this morning. Maybe I'll revert my revert commit tomorow morning.

Anthony-Breneliere avatar Sep 08 '22 21:09 Anthony-Breneliere

Great to see this project coming back to life which I used in the past but stepped away from owing to lack of maintenance. Great work!

cefn avatar Sep 09 '22 10:09 cefn

The main reason why this package has been abandonned is that it is useless.

The rare cases where you need some result text to be linked with the test, you just need to throw the message, and jest will format it well for you.

if ( expect_condition )
  throw new Error( myMessage );

@Anthony-Breneliere I would agree with you if there were a Jest API that exposed a conditional semantics (not an assertion+exception throwing semantics).

Then we would be able to consume all of the richness of expect(value).toFulfilSomething(special) giving us a boolean return while implicitly documenting the intent of .toFulfilSomething(special) from a software team perspective (by checking the boolean and explicitly associating a message). The power of all the matchers is not to be sniffed at, and best not reimplemented from scratch.

Especially when the composition of the assertion is a bit special (why should the object be exactly that shape) I would rather guide people to use Jest expressivity, and this library ALSO gives us the means of having team-meaningful statements in test failures. For example Session state hasn't settled - eventual consistency issue in upstream session index - check all writes are transactional might be the real intent of expect(context).toMatchObject({retrieval:{final:true}}) which is otherwise mystifying.

An alternative I've speculated about is to be able to catch Jest's specific expectation-matcher-failure exception, and rethrow it with the extra message attached. Once again, if Jest exposed the Exception type as part of the API this would be possible, but for now monkeypatching expect is the least-worst option.

cefn avatar Sep 09 '22 10:09 cefn