When running [[Special:JavaScriptTest/qunit/plain]] with VisualEditor installed, it currently fails during the ve.dm.TransactionProcessor test.
Sequence of events:
- All ve/ve-mw files have been executed.
- ve.init.mw.Platform immediately created an instance of itself (ve.init.platform = ..)
- ve.init.mw.Platform instantiates ve.init.mw.ImageInfoCache (this.imageInfoCache = ..)
- Test files are executing.
- Test cases for ve.dm.TransactionProcessor.
- ve.dm.MWImageNode is constructed.
- ve.dm.MWImageNode#getScalablePromise is called.
- getScalablePromise checks ve.init.platform.imageInfoCache. (It exists.)
- getScalablePromise calls ve.init.platform.imageInfoCache.get.
- imageInfoCache.get (inherited from mw.ApiResponseCache) calls ve.init.mw.ImageInfoCache#getRequestPromise.
- getRequestPromise assumes ve.init.target exists, accessing apiRequest.
- Boom!
This passes in production because the user doesn't initiate these code paths until after Platform and Target have settled.
Other files (e.g. ve.test.utils.js) instantiate their own Target object. The ve.dm.TransactionProcessor test (or something else) should also ensure that a target exists.