Linting
event emitter returned by API can emit done
before user listens it
#103
Labels
Linting
event emitter returned by API can emit done
before user listens it
#103
According to the example of the README, you must call
lintSource
to return aLinting
instance and then listen thedone
event on that to check that the linting has been terminated. The problem is thatLinting
can have another state different tolinting
at that point.These two tests are reproducing the behaviour:
svglint/test/valid.spec.js
Lines 57 to 65 in 3ce8e62
That's the reason why I added this check to the tester before calling
on('done', ... )
:svglint/test/helpers.js
Lines 25 to 38 in 3ce8e62
Is a race condition that happens because
Linting.lint()
is called atLinting
constructor and can callLinting.emit('done')
before the user listen the event. The most suitable solution is to not callthis.lint()
onLinting
constructor and force to the user to call it after setting event listeners. This is a breaking change.The text was updated successfully, but these errors were encountered: