Closed psmyrek closed 1 month ago
I checked again with version 15.2.0
and in general the problems are the same.
spy.calledWith()
cause the editor to throw an error: CKEditorError: model-nodelist-offset-out-of-bounds
.
spy.calledWith()
calls behaved in the same way.expect( spy.calledWith() )
we can use sinon.assert.calledWith( spy )
and these tests pass.sinon.useFakeTimers( { shouldClearNativeTimers: true } )
.Can't install fake timers twice on the same global object
. This is actually a problem with the test itself, because fake timers are initialized more than once. In an earlier version of sinon
such usage was silently ignored, but now it throws an error.I haven't noticed any problems with stubbing non-configurable or non-writable properties. Maybe some tests have changed a bit in the meantime and there are no such tests anymore.
In conclusion, it seems that we can try to upgrade sinon
to the latest version.
There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.
We've closed your issue due to inactivity. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it).
Currently, we are using
sinon
in9.x
version inckeditor5-dev-tests
. Current latest version ofsinon
is13.x
, so it would be good to bump it.However, there might be a few challenges (as we already tried it once quickly).
Executing
yarn run test -f engine,utils --production
fails:Error in
DowncastDispatcher
:calledWith()
assertion changes/triggers something in the model (?). There are some changes in thecalledWith()
assertion insinon
since v12 - see this commit.Error with fake timers.
--production
flag prevents from using any method from theconsole
. Bumping thesinon
package introduces also the new version offake-timers
package, which now requires to explicitly setshouldClearNativeTimers: true
- see the docs. Otherwise,fake-timers
prints the warning in the console, which is forbidden when our tests are executed with the--production
flag.Stubbing non-writable properties.
sinon
does not allow stubbing non-configurable or non-writable properties - see this commit. Previously, it just silently failed, but now it throws an error.