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

re.exec is not a function on .match #3

Closed
preflight opened this issue Apr 14, 2015 · 3 comments
Closed

re.exec is not a function on .match #3

preflight opened this issue Apr 14, 2015 · 3 comments

Comments

@preflight
Copy link

I'm getting TypeError: re.exec is not a function when trying to use chai-jquery's match assertion:

it('caches element', function() {
  expect(this.$el).to.match('#el');
});

All other assertions are working fine (to.have.class, to.exist, etc.). It looks like some updates were made for chai-jquery 2.0. Could this be a compatibility issue? Thanks

@jgerigmeyer
Copy link
Contributor

I ran into this same issue, but caused by the way chai-jquery checks whether the argument being matched is a jQuery object. I don't think it's related to this plugin. See chaijs/chai-jquery#36 and https://github.com/chaijs/chai-jquery/blob/master/chai-jquery.js#L197.

@mhfrantz
Copy link

What works for me is to turn the regex from a string to a regex, e.g.:

expect(this.$el).to.match(/#el/);

Credit: @damonomad

@jmendiara
Copy link
Owner

This issue is not related with karma-jquery-chai but chai-jquery as @jgerigmeyer says. Please, update your own chai-jquery dependency.

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

4 participants