You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example from the documentation for expectnotstringcontaingstring works when the substring isn't contained, but it gives a val.toAsymmetricMatcher is not a function error when the substring is contained. It's expected that the test should fail, but this does not seem like the expected error in this scenario.
To Reproduce
Create a file called string.test.js with the following contents.
describe('not.stringContaining',()=>{constexpected='are you?';it('matches if the actual string does not contain the expected substring',()=>{expect('How are you?').toEqual(expect.not.stringContaining(expected));});});
Then run the following.
jest
Expected behavior
The expected behavior is that this would produce an informative error about the substring being contained within the "How are you?" string when it is expected not to be.
Link to repl or repo (highly encouraged)
Here is a link to repl.it, but they're using version 22 and the error is different with that version. On v22 it is
TypeError: Cannot read property 'stringContaining' of undefined
and on v23 it is
TypeError: val.toAsymmetricMatcher is not a function
Run npx envinfo --preset jest
Paste the results here:
npx: installed 1 in 1.148s
System:
OS: Linux 4.9 Amazon Linux AMI 2017.09
CPU: x64 Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz
Binaries:
Node: 9.4.0 - ~/.nvm/versions/node/v9.4.0/bin/node
Yarn: 1.7.0 - ~/.nvm/versions/node/v9.4.0/bin/yarn
npm: 5.6.0 - ~/.nvm/versions/node/v9.4.0/bin/npm
npmPackages:
jest: ^23.0.0 => 23.0.0
The text was updated successfully, but these errors were encountered:
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
🐛 Bug Report
The example from the documentation for expectnotstringcontaingstring works when the substring isn't contained, but it gives a
val.toAsymmetricMatcher is not a function
error when the substring is contained. It's expected that the test should fail, but this does not seem like the expected error in this scenario.To Reproduce
Create a file called
string.test.js
with the following contents.Then run the following.
Expected behavior
The expected behavior is that this would produce an informative error about the substring being contained within the "How are you?" string when it is expected not to be.
Link to repl or repo (highly encouraged)
Here is a link to repl.it, but they're using version 22 and the error is different with that version. On v22 it is
and on v23 it is
Run
npx envinfo --preset jest
Paste the results here:
The text was updated successfully, but these errors were encountered: