Skip to content

Commit

Permalink
feat(core): internal stack integration with mocha runner
Browse files Browse the repository at this point in the history
Add mocha runner support to the internal stack.

Closes help-me-mom#838
  • Loading branch information
dpraul committed Jul 20, 2021
1 parent 0d3329e commit fd8514b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions libs/ng-mocks/src/lib/common/ng-mocks-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,30 @@ const installJestCircus = () => {
return true;
};

// istanbul ignore next
const installMochaReporter = () => {
try {
mocha.setup({
rootHooks: {
afterAll: stackPop,
beforeAll: () => stackPush('root'),
afterEach: stackPop,
beforeEach: () => stackPush('test'),
},
});

return true;
} catch {
return false;
}
};

const install = () => {
if (!ngMocksUniverse.global.has('reporter-stack-install')) {
let installed = false;
installed = installJasmineReporter() || /* istanbul ignore next */ installed;
installed = installJestCircus() || /* istanbul ignore next */ installed;
installed = installMochaReporter() || /* istanbul ignore next */ installed;
// istanbul ignore if
if (!installed) {
messageCoreChecker();
Expand Down

0 comments on commit fd8514b

Please sign in to comment.