Welcome to mirror list, hosted at ThFree Co, Russian Federation.

tdd.spec.js « only « misc « acceptance « test « mocha-3.1.0 « lib « tests - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7e37e7a3b3bb3351b1329395068eeb9fa5e4e26a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
suite('should only run .only test in this tdd suite', function() {
  test('should not run this test', function() {
    (0).should.equal(1, 'this test should have been skipped');
  });
  test.only('should run this test', function() {
    (0).should.equal(0, 'this .only test should run');
  });
  test('should run this test, not (includes the title of the .only test)', function() {
    (0).should.equal(1, 'this test should have been skipped');
  });
});

suite('should not run this suite', function() {
  test('should not run this test', function() {
    (true).should.equal(false);
  });

  test('should not run this test', function() {
    (true).should.equal(false);
  });

  test('should not run this test', function() {
    (true).should.equal(false);
  });
});

suite.only('should run all tests in this tdd suite', function() {
  test('should run this test #1', function() {
    (true).should.equal(true);
  });

  test('should run this test #2', function() {
    (1).should.equal(1);
  });

  test('should run this test #3', function() {
    ('foo').should.equal('foo');
  });
});

suite('should run only suites that marked as `only`', function() {
  suite.only('should run all this tdd suite', function() {
    test('should run this test #1', function() {
      (true).should.equal(true);
    });

    test('should run this test #2', function() {
      (true).should.equal(true);
    });
  });

  suite('should not run this suite', function() {
    test('should not run this test', function() {
      (true).should.equal(false);
    });
  });
});

// Nested situation
suite('should not run parent tests', function() {
  test('should not run this test', function() {
    (true).should.equal(false);
  });
  suite('and not the child tests too', function() {
    test('should not run this test', function() {
      (true).should.equal(false);
    });
    suite.only('but run all the tests in this suite', function() {
      test('should run this test #1', function() {
        (true).should.equal(true);
      });
      test('should run this test #2', function() {
        (true).should.equal(true);
      });
    });
  });
});

// mark test as `only` override the suite behavior
suite.only('should run only tests that marked as `only`', function() {
  test('should not run this test #1', function() {
    (false).should.equal(true);
  });

  test.only('should run this test #2', function() {
    (true).should.equal(true);
  });

  test('should not run this test #3', function() {
    (false).should.equal(true);
  });

  test.only('should run this test #4', function() {
    (true).should.equal(true);
  });
});

suite.only('Should run only test cases that mark as only', function() {
  test.only('should runt his test', function() {
    (true).should.equal(true);
  });

  test('should not run this test', function() {
    (false).should.equal(true);
  });

  suite('should not run this suite', function() {
    test('should not run this test', function() {
      (false).should.equal(true);
    });
  });
});

// Root Suite
test.only('#Root-Suite, should run this test-case #1', function() {
  (true).should.equal(true);
});

test.only('#Root-Suite, should run this test-case #2', function() {
  (true).should.equal(true);
});

test('#Root-Suite, should not run this test', function() {
  (false).should.equal(true);
});