Here is the code that illustrates how you can do this:
describe("top", function () {
before(function () {
console.log("full title:", this.test.fullTitle());
console.log("parent title:", this.test.parent.title);
});
it("test 1", function () {});
});
Run with the reporter spec, this will output:
full title: top "before all" hook
parent title: top
✓ test 1
1 passing (4ms)
Mocha , (describe, before, it ..), this Context. test. , , . before Hook, before. fullTitle() : , (describe), . Hook parent, , . title, , describe.