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

Jest-like simple interface #6

Closed
JakeSidSmith opened this issue Mar 7, 2017 · 7 comments
Closed

Jest-like simple interface #6

JakeSidSmith opened this issue Mar 7, 2017 · 7 comments

Comments

@JakeSidSmith
Copy link
Contributor

JakeSidSmith commented Mar 7, 2017

Started using chai-jest-snapshot recently with mocha, but I fear my colleagues will not like the additional effort of supplying a filepath & name for each snapshot.

Do you have any plans to allow a default / automatic filepath / name so that assertions can simply be made with:

expect(tree).to.matchSnapshot();

I'd love to help out if I can.

P.s. Additionally an easier way to update all snapshots would be nice, but I've not had any thoughts about ways to improve it yet. But if it were possible to do so with mocha -u (or similar, as this is already used for --ui), that'd be awesome.

@JakeSidSmith
Copy link
Contributor Author

JakeSidSmith commented Mar 7, 2017

Further thoughts:

You could allow users to define some config for how their snapshots will be output e.g.

chai.use(chaiJestSnapshot({
  // To match jest
  path: '__snapshots__', // relative or root
  suffix: '.snap',
  // Additional options
  prefix: 'snapshot'
}));

Possibly allow outputting versions as Jest does (which could be configured by users):

// Jest Snapshot v1, https://goo.gl/fbAQLP

truongsinh added a commit to truongsinh/chai-jest-snapshot that referenced this issue Mar 30, 2017
truongsinh added a commit to truongsinh/chai-jest-snapshot that referenced this issue Mar 30, 2017
@truongsinh
Copy link
Contributor

@JakeSidSmith @suchipi I made it in #7

@suchipi
Copy link
Owner

suchipi commented Mar 30, 2017

Thanks @truongsinh. I will try to take a look and offer a proper review sometime either this weekend or next. Also sorry I didn't reply to this earlier @JakeSidSmith, I looked at it from the notification which marked it as read, and then forgot about it

@JakeSidSmith
Copy link
Contributor Author

@suchipi that's kwl, done the same a bunch of times. @truongsinh had quick look at that PR, and looks good. Will take a better look a bit later. :)

@truongsinh
Copy link
Contributor

hi @suchipi, how is it going?

@suchipi
Copy link
Owner

suchipi commented Apr 4, 2017

Hi, @truongsinh, I haven't forgotten about you, I just had a busy weekend. I'll try to look at this sometime this weekend

@suchipi
Copy link
Owner

suchipi commented Apr 25, 2017

This was completed in #7 and I forgot to close this issue

@suchipi suchipi closed this as completed Apr 25, 2017
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

3 participants