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 [`it.skip()` function](https://mochajs.org/#inclusive-tests) tells Mocha to skip that particular test.
2
+
For example, in the following code, Mocha will **not** run `test2`.
3
+
4
+
```javascript
5
+
it('test1', function() {});
6
+
it.skip('test2', function() {});
7
+
it('test3', function() {});
8
+
```
9
+
10
+
Running Mocha on the above file will produce the following output.
11
+
Because test2 was skipped, Mocha will indicate that there's 1 "pending" test - "pending" tests are another word for skipped tests.
12
+
13
+
```
14
+
$ mocha ./test.js
15
+
16
+
17
+
✓ test1
18
+
- test2
19
+
✓ test3
20
+
21
+
2 passing (4ms)
22
+
1 pending
23
+
24
+
$
25
+
```
26
+
27
+
We recommend using `skip()` instead of commenting out tests.
28
+
The benefit of using `skip()` is that Mocha can tell you when there are tests skipped via the "pending" output, whereas Mocha can't tell you when there are commented out tests.
29
+
30
+
## With `describe()`
31
+
32
+
`.skip()` is the inverse of [`.only()`](./run-single-test): `skip()` skips the marked test, `only()` skips every test _other than_ the marked test.
33
+
Like `only()`, you can use `skip()` with `describe()` to skip a whole block of tests as follows.
0 commit comments