Repository: bokeh/bokeh

Issue:
Make bokehjs' build work with npm 5
On current master I cannot seem to run the JS unit tests at all locally using OSX. In a completely fresh environment with a fresh ``npm install`` I see the following errors when running ``gulp test``:

```
(bokeh_dev) 0276-prudiger:bokehjs philippjfr$ gulp test
[16:04:48] Using gulpfile ~/development/bokeh/bokehjs/gulpfile.js
[16:04:48] Starting 'defaults:generate'...
[16:04:54] generate_defaults.py: 

[16:04:54] generate_defaults.py: Wrote ./test/.generated_defaults/models_defaults.ts with 149 model classes
[16:04:54] generate_defaults.py: Wrote ./test/.generated_defaults/widgets_defaults.ts with 22 model classes
[16:04:55] Finished 'defaults:generate' after 6.13 s
[16:04:55] Starting 'test'...
⨯ Unable to compile TypeScript:
test/models/tickers/adaptive_ticker.ts (10,22): Only a void function can be called with the 'new' keyword. (2350)
test/models/tickers/adaptive_ticker.ts (10,22): Expected 0 arguments, but got 1. (2554)
test/models/tickers/adaptive_ticker.ts (15,22): Only a void function can be called with the 'new' keyword. (2350)
test/models/tickers/adaptive_ticker.ts (15,22): 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. (7009)
test/models/tickers/adaptive_ticker.ts (20,22): Only a void function can be called with the 'new' keyword. (2350)
test/models/tickers/adaptive_ticker.ts (20,22): Expected 0 arguments, but got 1. (2554)
test/models/tickers/adaptive_ticker.ts (28,22): Only a void function can be called with the 'new' keyword. (2350)
test/models/tickers/adaptive_ticker.ts (28,22): Expected 0 arguments, but got 1. (2554)
test/models/tickers/adaptive_ticker.ts (34,22): Only a void function can be called with the 'new' keyword. (2350)
test/models/tickers/adaptive_ticker.ts (34,22): Expected 0 arguments, but got 1. (2554)
test/models/tickers/adaptive_ticker.ts (40,22): Only a void function can be called with the 'new' keyword. (2350)
test/models/tickers/adaptive_ticker.ts (40,22): Expected 0 arguments, but got 1. (2554)
test/models/tickers/adaptive_ticker.ts (46,22): Only a void function can be called with the 'new' keyword. (2350)
test/models/tickers/adaptive_ticker.ts (46,22): Expected 0 arguments, but got 1. (2554)
test/models/tickers/adaptive_ticker.ts (52,22): Only a void function can be called with the 'new' keyword. (2350)
test/models/tickers/adaptive_ticker.ts (52,22): Expected 0 arguments, but got 1. (2554)
[16:05:01] 'test' errored after 6.34 s
[16:05:01] Error in plugin 'mocha'
Message:
    tests failed
```

@mattpap Would be great if you could take a look at this, @bryevdv reported the same issue locally.


Discussion:
@philippjfr @mattpap is there any concrete action to take from this?
I think the way to fix this was to downgrade ``npm``, is there a way to ensure that it installs the correct npm version by default?
We either should lock node to 6.x branch in meta.yaml, or make our build work with npm 5.

Resolving patch:
diff --git a/_setup_support.py b/_setup_support.py
--- a/_setup_support.py
+++ b/_setup_support.py
@@ -420,7 +420,7 @@ def package_path(path, filters=()):
 
     %s
 
-Have you run `npm install` from the bokehjs subdirectory?
+Have you run `npm install --no-save` from the bokehjs subdirectory?
 For more information, see the Dev Guide:
 
     https://bokeh.pydata.org/en/latest/docs/dev_guide.html


Test patch:
diff --git a/bokehjs/test/models/scales/log_scale.coffee b/bokehjs/test/models/scales/log_scale.coffee
--- a/bokehjs/test/models/scales/log_scale.coffee
+++ b/bokehjs/test/models/scales/log_scale.coffee
@@ -50,17 +50,24 @@ describe "LogScale module", ->
   describe "invert method", ->
 
     it "should inverse map values logly", ->
-      expect(@scale.invert(-15)).to.be.equal 0.09999999999999996
-      expect(@scale.invert(10)).to.be.equal 1
-      expect(@scale.invert(35)).to.be.equal 10.000000000000004
-      expect(@scale.invert(60)).to.be.equal 100.00000000000007
-      expect(@scale.invert(85)).to.be.equal 1000.0000000000014
-      expect(@scale.invert(110)).to.be.equal 10000.000000000007
+      expect(@scale.invert(-15)).to.be.closeTo(0.1, 1e-10)
+      expect(@scale.invert(10)).to.be.closeTo(1, 1e-10)
+      expect(@scale.invert(35)).to.be.closeTo(10, 1e-10)
+      expect(@scale.invert(60)).to.be.closeTo(100, 1e-10)
+      expect(@scale.invert(85)).to.be.closeTo(1000, 1e-10)
+      expect(@scale.invert(110)).to.be.closeTo(10000, 1e-10)
 
   describe "v_invert method", ->
 
     it "should vector map inverse map values logly", ->
-      expect(@scale.v_invert([-15, 10, 35, 60, 85, 110])).to.be.deep.equal new Float64Array [0.09999999999999996, 1, 10.000000000000004, 100.00000000000007, 1000.0000000000014, 10000.000000000007]
+      value = @scale.v_invert([-15, 10, 35, 60, 85, 110])
 
-    it "should inverse map to a Float64Array", ->
-      expect(@scale.v_invert([-1,0,5,10,11])).to.be.instanceof Float64Array
+      expect(value).to.be.instanceof(Float64Array)
+      expect(value.length).to.be.equal(6)
+
+      expect(value[0]).to.be.closeTo(0.1, 1e-10)
+      expect(value[1]).to.be.closeTo(1, 1e-10)
+      expect(value[2]).to.be.closeTo(10, 1e-10)
+      expect(value[3]).to.be.closeTo(100, 1e-10)
+      expect(value[4]).to.be.closeTo(1000, 1e-10)
+      expect(value[5]).to.be.closeTo(10000, 1e-10)