Skip to content

Commit c473eee

Browse files
lddubeauaciccarello
authored andcommitted
Mock the plugins. (#726)
Doing this prevents the plugin-host tests from dumping a stack trace to the console and looking like a serious failure occurred.
1 parent 83e64aa commit c473eee

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

package-lock.json

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
},
5151
"devDependencies": {
5252
"@types/mocha": "2.2.48",
53+
"@types/mockery": "^1.4.29",
5354
"grunt": "^1.0.2",
5455
"grunt-cli": "^1.2.0",
5556
"grunt-contrib-clean": "^1.0.0",
@@ -61,6 +62,7 @@
6162
"grunt-tslint": "^5.0.1",
6263
"istanbul": "^0.4.1",
6364
"mocha": "^5.0.4",
65+
"mockery": "^2.1.0",
6466
"tslint": "^5.9.1"
6567
},
6668
"files": [

src/test/plugin-host.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
import { Application } from '..';
22
import Assert = require('assert');
3+
import * as mockery from 'mockery';
34

45
describe('PluginHost', function () {
6+
before (function () {
7+
mockery.enable({
8+
warnOnReplace: false,
9+
warnOnUnregistered: false
10+
});
11+
mockery.registerMock('typedoc-plugin-1', () => {});
12+
mockery.registerMock('typedoc-plugin-2', () => {});
13+
});
14+
15+
after(function () {
16+
mockery.disable();
17+
});
18+
519
it('parses plugins correctly', function () {
620
let app = new Application({
721
plugin: 'typedoc-plugin-1,typedoc-plugin-2'

0 commit comments

Comments
 (0)