Skip to content

Latest commit

 

History

History
236 lines (206 loc) · 3.53 KB

example.md

File metadata and controls

236 lines (206 loc) · 3.53 KB

Example

it('global test', function() {

});

describe('suite 1', function() {
  describe('suite 2', function() {
    it('test2', function() {
      expect(true).to.be.true;
    });
  });

  it('test1', function() {
    expect(true).to.be.true;
    expect(true).to.be.false;
  });
});

For the above Mocha test suite, the following events and even data are expected to be emitted by a CRI-compliant interface (Common Reporter Interface):

  • runStart:
Suite {
  name: undefined,
  fullName: [],
  tests: [Test('global test')],
  childSuites: [Suite('suite1')],
  status: undefined,
  testCounts: {
    passed: undefined,
    failed: undefined,
    skipped: undefined,
    total: 2
  },
  runtime: undefined
}
  • testStart
Test {
  name: 'global test',
  suiteName: undefined,
  fullName: ['global test'],
  status: undefined,
  runtime: undefined,
  errors: undefined,
  assertions: undefined
}
  • testEnd
Test {
  name: 'global test',
  suiteName: undefined,
  fullName: ['global test'],
  status: 'passed',
  runtime: 1,
  errors: [],
  assertions: []
  • suiteStart
Suite {
  name: 'suite1',
  fullName: ['suite1'],
  tests: [Test('test1')],
  childSuites: [Suite('suite2')],
  status: undefined,
  testCounts: {
    passed: undefined,
    failed: undefined,
    skipped: undefined,
    total: 2
  },
  runtime: undefined
  • suiteStart
Suite {
  name: 'suite2',
  fullName: ['suite1', 'suite2'],
  tests: [Test('test2')],
  childSuites: [],
  status: undefined,
  testCounts: {
    passed: undefined,
    failed: undefined,
    skipped: undefined,
    total: 1
  },
  runtime: undefined
  • testStart
Test {
  name: 'test2',
  suiteName: 'suite2',
  fullName: ['suite1', 'suite2', 'test2'],
  status: undefined,
  runtime: undefined,
  errors: undefined,
  assertions: undefined
  • testEnd:
Test {
  name: 'test2',
  suiteName: 'suite2',
  fullName: ['suite1', 'suite2', 'test2'],
  status: `passed`,
  runtime: 1,
  errors: [],
  assertions: [{
    passed: true,
    actual: true,
    expected: true,
    message: `some message`,
    stack: undefined
  }]
  • suiteEnd
Suite {
  name: 'suite2',
  fullName: ['suite1', 'suite2'],
  tests: [Test('test2')],
  childSuites: [],
  status: `passed`,
  testCounts: {
    passed: 1,
    failed: 0,
    skipped: 0,
    total: 1
  },
  runtime: 1
  • testStart
Test {
  name: 'test1',
  suiteName: 'suite1',
  fullName: ['suite1', 'test'],
  status: undefined,
  runtime: undefined,
  errors: undefined,
  assertions: undefined
  • testEnd:
Test {
  name: 'test1',
  suiteName: 'suite1',
  fullName: ['suite1', 'test'],
  status: `failed`,
  runtime: 2,
  errors: [{
    passed: false,
    actual: true,
    expected: false,
    message: `some message`,
    stack: `stack trace`
  }],
  assertions: [{
    passed: true,
    actual: true,
    expected: true,
    message: `some message`,
    stack: undefined
  }, {
    passed: false,
    actual: true,
    expected: false,
    message: `some message`,
    stack: `stack trace`
  }]
  • suiteEnd
Suite {
  name: 'suite1',
  fullName: ['suite1'],
  tests: [Test('test1')],
  childSuites: [],
  status: `failed`,
  testCounts: {
    passed: 1,
    failed: 1,
    skipped: 0,
    total: 2
  },
  runtime: 3
  • runEnd:
Suite {
  name: undefined,
  fullName: [],
  tests: [Test('global test')],
  childSuites: [Suite('suite1')],
  status: `failed`,
  testCounts: {
    passed: 2,
    failed: 1,
    skipped: 0,
    total: 3
  },
  runtime: 4
}