From 7d635b3167044eea853cb3783567f75efb151be0 Mon Sep 17 00:00:00 2001 From: yungsters Date: Wed, 8 Apr 2015 17:29:48 -0700 Subject: [PATCH] Implement `addMatchers` shortcut on `jest` --- docs/API.md | 1 + src/HasteModuleLoader/HasteModuleLoader.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/docs/API.md b/docs/API.md index 83d1b1ff1f4f..31b62c32cb34 100644 --- a/docs/API.md +++ b/docs/API.md @@ -8,6 +8,7 @@ permalink: docs/api.html #### The `jest` object + - `jest.addMatchers(matchers)` - [`jest.autoMockOff()`](#jest-automockoff) - [`jest.autoMockOn()`](#jest-automockon) - [`jest.clearAllTimers()`](#jest-clearalltimers) diff --git a/src/HasteModuleLoader/HasteModuleLoader.js b/src/HasteModuleLoader/HasteModuleLoader.js index cfe8c3030829..c80684dc554f 100644 --- a/src/HasteModuleLoader/HasteModuleLoader.js +++ b/src/HasteModuleLoader/HasteModuleLoader.js @@ -952,6 +952,12 @@ Loader.prototype.resetModuleRegistry = function() { 'jest-runtime': function(currPath) { var jestRuntime = { exports: { + addMatchers: function(matchers) { + var jasmine = this._environment.global.jasmine; + var spec = jasmine.getEnv().currentSpec; + spec.addMatchers(matchers); + }.bind(this), + autoMockOff: function() { this._shouldAutoMock = false; return jestRuntime.exports;