|
1 | 1 | describe('should only run .only test in this bdd suite', function() {
|
2 | 2 | it('should not run this test', function() {
|
3 |
| - var zero = 0; |
4 |
| - expect(zero).to.equal(1, 'this test should have been skipped'); |
| 3 | + (0).should.equal(1, 'this test should have been skipped'); |
5 | 4 | });
|
6 |
| - it.only('should run this test', function() { |
7 |
| - var zero = 0; |
8 |
| - expect(zero).to.equal(0, 'this .only test should run'); |
| 5 | + it.only('should run this test', function() { |
| 6 | + (0).should.equal(0, 'this .only test should run'); |
9 | 7 | });
|
10 | 8 | it('should run this test, not (includes the title of the .only test)', function() {
|
11 |
| - var zero = 0; |
12 |
| - expect(zero).to.equal(1, 'this test should have been skipped'); |
| 9 | + (0).should.equal(1, 'this test should have been skipped'); |
13 | 10 | });
|
14 | 11 | });
|
| 12 | + |
| 13 | +describe('should not run this suite', function() { |
| 14 | + it('should not run this test', function() { |
| 15 | + (true).should.equal(false); |
| 16 | + }); |
| 17 | + |
| 18 | + it('should not run this test', function() { |
| 19 | + (true).should.equal(false); |
| 20 | + }); |
| 21 | + |
| 22 | + it('should not run this test', function() { |
| 23 | + (true).should.equal(false); |
| 24 | + }); |
| 25 | +}); |
| 26 | + |
| 27 | +describe.only('should run all tests in this bdd suite', function() { |
| 28 | + it('should run this test #1', function() { |
| 29 | + (true).should.equal(true); |
| 30 | + }); |
| 31 | + |
| 32 | + it('should run this test #2', function() { |
| 33 | + (1).should.equal(1); |
| 34 | + }); |
| 35 | + |
| 36 | + it('should run this test #3', function() { |
| 37 | + ('foo').should.equal('foo'); |
| 38 | + }); |
| 39 | +}); |
| 40 | + |
| 41 | +describe('should run only suites that marked as `only`', function() { |
| 42 | + describe.only('should run all this tdd suite', function() { |
| 43 | + it('should run this test #1', function() { |
| 44 | + (true).should.equal(true); |
| 45 | + }); |
| 46 | + |
| 47 | + it('should run this test #2', function() { |
| 48 | + (true).should.equal(true); |
| 49 | + }); |
| 50 | + }); |
| 51 | + |
| 52 | + describe('should not run this suite', function() { |
| 53 | + it('should run this test', function() { |
| 54 | + (true).should.equal(false); |
| 55 | + }); |
| 56 | + }); |
| 57 | +}); |
| 58 | + |
| 59 | +// Nested situation |
| 60 | +describe('should not run parent tests', function() { |
| 61 | + it('should not run this test', function() { |
| 62 | + (true).should.equal(false); |
| 63 | + }); |
| 64 | + describe('and not the child tests too', function() { |
| 65 | + it('should not run this test', function() { |
| 66 | + (true).should.equal(false); |
| 67 | + }); |
| 68 | + describe.only('but run all the tests in this suite', function() { |
| 69 | + it('should run this test #1', function() { |
| 70 | + (true).should.equal(true); |
| 71 | + }); |
| 72 | + it('should run this test #2', function() { |
| 73 | + (true).should.equal(true); |
| 74 | + }); |
| 75 | + }); |
| 76 | + }); |
| 77 | +}); |
| 78 | + |
| 79 | +// mark test as `only` override the suite behavior |
| 80 | +describe.only('should run only tests that marked as `only`', function() { |
| 81 | + it('should not run this test #1', function() { |
| 82 | + (false).should.equal(true); |
| 83 | + }); |
| 84 | + |
| 85 | + it.only('should run this test #2', function() { |
| 86 | + (true).should.equal(true); |
| 87 | + }); |
| 88 | + |
| 89 | + it('should not run this test #3', function() { |
| 90 | + (false).should.equal(true); |
| 91 | + }); |
| 92 | + |
| 93 | + it.only('should run this test #4', function() { |
| 94 | + (true).should.equal(true); |
| 95 | + }); |
| 96 | +}); |
| 97 | + |
| 98 | +describe.only('Should run only test cases that mark as only', function() { |
| 99 | + it.only('should runt his test', function() { |
| 100 | + (true).should.equal(true); |
| 101 | + }); |
| 102 | + |
| 103 | + it('should not run this test', function() { |
| 104 | + (false).should.equal(true); |
| 105 | + }); |
| 106 | + |
| 107 | + describe('should not run this suite', function() { |
| 108 | + it('should not run this test', function() { |
| 109 | + (false).should.equal(true); |
| 110 | + }); |
| 111 | + }); |
| 112 | +}); |
| 113 | + |
| 114 | +// Root Suite |
| 115 | +it.only('#Root-Suite, should run this test-case #1', function() { |
| 116 | + (true).should.equal(true); |
| 117 | +}); |
| 118 | + |
| 119 | +it.only('#Root-Suite, should run this test-case #2', function() { |
| 120 | + (true).should.equal(true); |
| 121 | +}); |
| 122 | + |
| 123 | +it('#Root-Suite, should not run this test', function() { |
| 124 | + (false).should.equal(true); |
| 125 | +}); |
0 commit comments