@@ -140,6 +140,37 @@ it('counts multiple assertions too', async () => {
140140});
141141```
142142
143+ ** Comments are ignored**
144+ ``` js
145+ it (' ignores commented-out assertions' , async () => {
146+ const res = await fetch (' www.example.com' );
147+ // expect(res.json).toBeTruthy();
148+ const json = await res .json ();
149+ /*
150+ expect(json).toEqual({ whatever: 'trevor1' });
151+ */
152+ expect (json).toEqual ({ whatever: ' trevor' });
153+ /* expect(json).toEqual({ whatever: 'trevor2' }); */
154+ });
155+ ```
156+
157+ ` ↓ ↓ ↓ ↓ ↓ ↓ `
158+
159+ ``` js
160+ it (' counts multiple assertions too' , async () => {
161+ expect .hasAssertions ();
162+ expect .assertions (1 );
163+ const res = await fetch (' www.example.com' );
164+ // expect(res.json).toBeTruthy();
165+ const json = await res .json ();
166+ /*
167+ expect(json).toEqual({ whatever: 'trevor1' });
168+ */
169+ expect (json).toEqual ({ whatever: ' trevor' });
170+ /* expect(json).toEqual({ whatever: 'trevor2' }); */
171+ });
172+ ```
173+
143174### Override
144175
145176If you add either ` expect.assertions(number) ` or ` expect.hasAssertions() ` then your defaults will be favoured and the
@@ -180,8 +211,8 @@ it('will leave test as override supplied', () => {
180211## Contributors
181212
182213<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
183- | [ <img src =" https://avatars0.githubusercontent.com/u/5610087?v=4 " width =" 100px; " /><br /><sub >Matt Phillips</sub >] ( http://mattphillips.io ) <br />[ 💻] ( https://github.com/mattphillips/babel-jest-assertions/commits?author=mattphillips " Code ") [ 📖] ( https://github.com/mattphillips/babel-jest-assertions/commits?author=mattphillips " Documentation ") [ 🚇] ( #infra-mattphillips " Infrastructure (Hosting, Build-Tools, etc) ") [ ⚠️] ( https://github.com/mattphillips/babel-jest-assertions/commits?author=mattphillips " Tests ") |
184- | :---: |
214+ | [ <img src =" https://avatars0.githubusercontent.com/u/5610087?v=4 " width =" 100px; " /><br /><sub >Matt Phillips</sub >] ( http://mattphillips.io ) <br />[ 💻] ( https://github.com/mattphillips/babel-jest-assertions/commits?author=mattphillips " Code ") [ 📖] ( https://github.com/mattphillips/babel-jest-assertions/commits?author=mattphillips " Documentation ") [ 🚇] ( #infra-mattphillips " Infrastructure (Hosting, Build-Tools, etc) ") [ ⚠️] ( https://github.com/mattphillips/babel-jest-assertions/commits?author=mattphillips " Tests ") | [ < img src = " https://avatars0.githubusercontent.com/u/266594?v=4 " width = " 100px; " />< br />< sub >Ramesh Nair</ sub > ] ( https://hiddentao.com/ ) < br /> [ 💻 ] ( https://github.com/mattphillips/babel-jest-assertions/commits?author=hiddentao " Code ") [ 📖 ] ( https://github.com/mattphillips/babel-jest-assertions/commits?author=hiddentao " Documentation ") [ 💡 ] ( #example-hiddentao " Examples ") [ ⚠️ ] ( https://github.com/mattphillips/babel-jest-assertions/commits?author=hiddentao " Tests ") |
215+ | :---: | :---: |
185216<!-- ALL-CONTRIBUTORS-LIST:END -->
186217
187218## LICENSE
0 commit comments