Move to using const and let
matatk opened this issue · comments
This will be possible when PhantomJS 2.5 is out: ariya/phantomjs#14506
Have moved from PhantomJS to Karma, running the browsers for real (using headless Chrome on Travis). The tests and most of the main code have now been moved to using const
and let
, however...
Can't fully move to using ES6 until #38 is done, because currently everything's attached to window
using var
. (Before moving to NPM scripts, "exports.js" handled this, but the current build doesn't use it, and it doesn't seem time-efficient to fix that until after I have grokked how to properly re-assmenble the separated-out flies for production; using uglify's --wrap
option looks like the right way.)
Update: rollup should be used when moving to ES6 modules.
This can't be fully implemented until I've found the idiomatic way to do exposing things for test, and for wrapping all the internal API stuff for minification/production.
Current constraints (using spec/AudioChart.spec.js
as an example):
- Jasmine can spy on
getAudioContext()
when it's declared as avar
because it's onwindow
. But I want to declare asconst
. - If I declare it as
const
then, if I could also run each (source script, test spec) pair of scripts in a separate environment, then I could easily stub outgetAudioContext()
—but Karma doesn't support this; all source files are included at once in the browser window, sogetAudioContext()
is already declared and I can't stub it out, as that's a redeclaration of aconst
.