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

Make compatible with Jest #9

Open
russcarver opened this issue Aug 1, 2017 · 6 comments
Open

Make compatible with Jest #9

russcarver opened this issue Aug 1, 2017 · 6 comments

Comments

@russcarver
Copy link

russcarver commented Aug 1, 2017

This is some great stuff! However we have recently migrated from Karma to Jest and Jest does not expose the createSpyObj method of Jasmine. As such, I've had to "copy" over the mocks you have that I want to use and have them use this version of `createSpyObj'. If you could incorporate it somehow into your code, that would be great!!

export function  createSpyObj (baseName: string, methodNames: string[]): { [key: string]: jasmine.Spy } {
  const obj: any = {}
  for (let i: number = 0; i < methodNames.length; i++) {
    obj[methodNames[i]] = jasmine.createSpy(baseName, () => {})
  }
  return obj
}
@stonelasley
Copy link
Owner

@russcarver thanks for the issue. I've never used Jest but I'll have a look.

@MagicAardvark
Copy link

+1 on this, Id love to use your mocks but using jest is painful with it.

@stonelasley
Copy link
Owner

@russcarver @MagicAardvark do either of you have a public project that is using jest that I could clone and tinker with?

@MagicAardvark
Copy link

I do not currently, Jest is very very simple to set up. as a temporary fix I can offer a 'fix' I made to your code to use @russcarver's suggestion above. ill open a PR for you.

@stonelasley
Copy link
Owner

@MagicAardvark, thank you.

@MagicAardvark
Copy link

#31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants