CHANGELOG.md
April 28, 2026 ยท View on GitHub
2026-04-28 v3.0.0
-
Migrated all source code to modern JavaScript syntax.
-
Migrated to modern ES Modules and build system.
-
All mock handlers now have a unique id (UUID) versus sequential integer matching place in registration array.
-
retainAjaxCallsis now an integer that represents the number of ajax calls to retain (defaults to -1, meaning retain all); using a boolean is deprecated, but still supported. -
Added
followRedirectsglobal setting which defaults totrue(which was the previous functionality). Change this tofalseto return3XXstatus codes from mock handlers and NOT follow them to theirLocationheader. -
statusTextcan now be an array whenstatusis an array to randomly select astatusTextfor the response. -
Added proper validation for all mock handler properties with more helpful error messages.
-
Added
$.mockjax.clearAll(),$.mockjax.clearById(), and$.mockjax.clearByUrl()methods to replace unclearclear()method (deprecated, but still supported). -
Added
$.mockjax.resetSettings()method to reset global settings to defaults. -
Added
$.mockjax.validateSettings()method to validate global Mockjax settings (throwsTypeErrorif not valid). -
Changed
headersin mock handler toresponseHeadersto avoid confusion withrequestHeadersmock handler matching property. -
Added full unit test suite in addition to existing integration tests and improved tests for Nodejs and RequireJS.
-
Added code coverage tooling and minimums.
-
Improved documentation of previously undocumented features and nuances as well as updated guidance for contributors.
-
Added JSDoc blocks everywhere for better type checking during dev.
-
Added code linting during build process for consistent style and to catch code issues early.
-
Deprecated settings and methods:
- Version
1.xof Mockjax is deprecated and will no longer be supported - The
headersproperty on mock handlers and in global settings is deprecated (useresponseHeadersin the same way). - The
$.mockjax.handler(id)method is deprecated (usehandlers([id])). - The
$.mockjax.clear()method is deprecated (use the appropriateclearByXx()method). - The
typematching property on mock handlers is deprecated (usemethodin the same way). - The
proxyTypesettings on both global settings and mock handlers is deprecated (useproxyMethodin the same way). - Boolean values for
retainAjaxCallsare deprecated (use integer values,-1replicates deprecatedtrueand0replicates deprecatedfalse). - The
loggingsetting is deprecated (uselogLevelin the same way).
- Version
-
Potentially Breaking Changes:
- NOTE: few of these are true breaking changes. We have kept the API almost entirely stable. That said, there were many changes in 3.x that could break your tests, especially if you were using workarounds or undocumented "features".
- The global
$.mockjaxSettingsare now validated when the first mock handler is registered, throwing aTypeErrorif any of the settings are invalid and not registering the handler. - Passing no matching properties when registering a new handler will result in
TypeError. - A mock responseXML that is invalid will now throw a
TypeErrorin addition to triggering the jQuery "xmlParseError" error on$(document). $.mockjaxSettings.logwas removed (it was deprecated previously, useloggerinstead).- We now use UUIDs for handler IDs. If you were using the old integer IDs in a way that relied on them being sequentially numeric and matching the array of mock handler registrations, your code may break!
- The default response headers no longer include "etag" or "content-type" unless necessary.
- Mock data matching got more robust, which might break some mock handler matches.
- The RegExp used for url wildcard matching ("/api/*") got a bit more specific in what constitutes a valid URL character, which might break some mock handler matches.
- The
clearand newclearByXx()methods now only clear out mocked ajax calls that match the cleared handlers (versus all mocked and unmocked calls as before). This could cause problems if you previously expected all retained mocked ajax calls to be removed when runningclear(), and this may cause increased memory usage. - The
handlers()method now deep clones each handler, which could have a performance impact if used to retrieve many handlers. It could also break your code if you modified mock handlers after registration. - When using a proxy, mockjax no longer uses the proxy request's status code for the mock response status if it was not set on the mock handler (will use the default:
200). - The timing of the toggle for the "fired" boolean on a mock handler changed to reflect mocking of redirects, which may affect what
unfiredHandlers()returns in some edge cases. - RegExp URL matching with namespaces changed to ensure group matching with
urlParams, which may affect code that was working around this issue. - The mock handler no longer tracks the
cache,timeout, orglobalproperties from the original ajax settings object. - The default logger implementation now emulates console logging methods more closely. Additionally, mock handlers no longer have their own
loggingoption for the log level (this was previously undocumented). This could break any custom logger implementations. - The
logLevelMethodsglobal setting was removed. All custom logger implementations must have standardwindow.consolelogging methods (error,warn,info,log,debug). - Checks for Regular Expressions in matching criteria now use
instanceof RegExpinstead of checking for atestmethod on the object. This may cause some mocks not to match if you were abusing this fact. - In jQuery 4.0.0 the team introduced a change that uses script tags in more situations, specifically with the
dataType"script" anddataType"jsonp". Mockjax will add an arbitrary header ("X-Mockjax: true") for these types of requests to bypass the issue. See: https://jquery.com/upgrade-guide/4.0/#breaking-change-script-tags-now-used-for-all-async-requests
2026-02-23 v2.7.0
- Updated tests to support for jQuery 4.0.0
- Note changes in v2.7.0-beta.0!
2024-09-09 v2.7.0-beta.0
- Support for jQuery 4.0.0-beta
- Removed deprecated calls to .isFunction()
- Updated cross-origin tests to use a safe domain
- Thanks to @jayaddison for the nudge and PR!
2024-02-17 v2.6.1
- Changed license from dual (MIT & GPL) to only be MIT
- Updated authorship to myself (creator of all v2 changes) and moved JD Sharp to contributor
- Massive (long needed) update to dev dependencies, and thus most of the test and build infrastructure
- NO source code changes, but the minified version will change due to dependency updates
- Remove support for IE 11 and requirejs
- Remove support for older versions of jQuery (supporting latest on each major branch)
2020-08-22 v2.6.0
- Removed support for IE 9 & 10
- Removed unused config for code climate
- Updated dev dependencies to fix browserstack and local test run issues
- Added support for regex url matching when using a namespace (thanks @gregid)
2020-03-30 v2.5.1
- Fixed issue with capitalization of the "content-type" header
- Added newer version of jQuery for testing
- Fixed issue where we were not running one subset of tests
2018-07-29 v2.5.0
- Added support for ignoring test files in the automated runs; this was necessary because Browserstack does something weird with the console and it causes the logging tests to timeout
- Fixed Browserstack automated runs by ignoring logging tests
- Added an option to reverse the mock handler priority order (thanks @addepar-andy)
2018-06-17 v2.4.0
- Added support for an array of status codes in mocked response (thanks @reinrl)
- Updated broken Codacy badge
- Added jQuery 3.3.1 to test suite
- Switched to using Chrome headless (with puppeteer) for all tests
- No longer testing in Opera, and added Edge to the browser test list
2018-01-07 v2.3.0
- Added new
handlers()method - Add basic support for 301 and 302 status codes with auto-redirection
- Fix up some README issues
2016-09-15 v2.2.2
- Minor bug fixes having to do with namespacing (thanks @tomeara)
- Improvement to testing CLI commands
2016-09-15 v2.2.1
- Add tests for jQuery 3.x
- Add tests for Browserify usage and documentation on that subject
- Updated dependencies for webpack, etc usage (thanks @hotoo)
- Updated keywords to be picked up by jQuery plugin registry
2016-06-08 v2.2.0
- Fix bower dependency on jQuery to allow any supported version
- Allow developer to indicate that ajax calls should not be retained (thanks @suchipi)
- Fix to allow responseTime to work with deferred jsonp
- Updated to test on latest jQuery versions
- Added JSDoc3 blocks to public API methods
- Refactored logging: now has levels, easier to overwrite, more messages
- Added ability for
datamatching to be a function (thanks @koorgoo) - Added ability to pass in array of mocks in addition to singles (thanks again @koorgoo)
2016-02-07 v2.1.1
- Reorganize test cases into separate files for ease of maintenance and testing
- Fix #86: JSONP return data treated as JSON
- Added jQuery 1.12.0 to test quite
- Fix #105: Using XML files as proxies
- Fix #267: Handle undefined URL argument correctly
- Fix #123: Handle query string formatted data option
2016-01-23 v2.1.0
- Removed unused testswarm files
- Added test step in build process for dist file
- Refactor tests to be easier to maintain and conform to current QUnit standards
- Added global URL namespace feature (thanks @danpaz)
- Added clearing of mocks by URL and regex (thanks @stas-vilchik)
- Use async setting for proxy data (thanks @udnisap)
- Update tests to jQuery 2.2.0 and fix for latest in jQuery git (thanks Simon and @gyoshev)
- Fixed #136: cross domain requests
- Updated contributing documentation to clearly state process for a release
2015-06-11 v2.0.1
- Fixed name in package.json for coordination among package management systems
2015-06-11 v2.0.0
- Fixed issue with isTimeout switch
- Reorganized codebase and implemented Grunt build process
- Implemented automated QUnit tests via Grunt and "shortcut" button in web tests
- Added JSHint task for catching issues earlier
- Implemented UMD pattern for use with require, browser, Node, etc
- Removed support for jQuery < 1.5.x
- Removed deprecated
$.mockjaxClear()method in favor of$.mockjax.clear() - Fixed numerous bugs (see issues for more info)
- Refactored tests a bit (needs a lot more)
- Added Travis CI for tests and Codacy for static code analysis
2015-04-08 v1.6.2
- Update jQuery library test versions on both 1.x and 2.x branches
- Remove duplicate "repositories" value in package.json (@wfortin)
- Remove undefined "head" variable in jsonp request mocking
- Added async
responsefunction ability - Added ability to specify range for responseTime with random selection
- Reorganized documentation significantly
2014-10-29 v1.6.1
- Changed all references to appendTo to point to github.com/jakerella (new owner)
- removed unused testswarm files
2014-10-09 v1.6.0
- Added
unfiredHandlers()andunmockedAjaxCalls() - Numerous bug fixes and breaking tests
- Internal method cleanup
- Switched to throwing proper
Errorobjects - Switched to tab indentation everywhere
- Added
mainfield to package.json - Fixed responseTime for jsonp and allowed for variable setting with array min/max
- Added
onAfterXxxxxcallbacks - Updated
$.mockjaxClear()to be$.mockjax.clear()with deprecation notice - Complete README documentation overhaul
- Fixed issue with Async actions in response callback
- Added "contributing" documentation
2014-08-14
- Spelling corrections in README.md
- Update to newest version of QUnit (JS & CSS) and fixes for doing so
- Added further versions of jQuery to test with
- Added some tests for various issues and split out some tests for atomicity
- Fixed dataType check for JSONP (case insensitive)
- ensure request
datamatching occurs when url is matched and no data matching is required
2013-09-28
- Fixed issue with proxy data and status codes (Thanks Andrew Goodale!)
2012-05-30 v1.5.2
- Added support for jQuery 1.8, 1.9, 2.0
2011-03-25 Jonathan Sharp (http://jdsharp.com)
- Updating jQuery 1.5rc1 to 1.5.1
- Adding TestSwarm support
2011-02-03 Jonathan Sharp (http://jdsharp.com)
- Added log setting to intercept or disable logging messages
- Added proxyType setting to force request type when proxying a mock
- Added 29 unit tests for jQuery 1.3 through 1.5
- Fixed issue #4 - Compatibility with jQuery 1.3
- Fixed issue #10 - Undefined contents
- Fixed issue #15 - proxy setting request type
- Fixed issue #16 - proxy setting request type
- Fixed issue #17 - jsonp request handling
- Fixed issue #18 - Unit test fail with jQuery 1.5