sazeracjs/sazerac

Node 4.x compatibility

Closed this issue ยท 4 comments

I'm using node 4.8.1, and include the library like this:

'use strict'
const test = require('sazerac').test,
  given = require('sazerac').given;
...

(import { test, given } from 'sazerac' syntax is not supported in node 4.x that I know of)

When I try to run my tests, it gives this error:

vagrant@precise64:/vagrant$ mocha
/vagrant/node_modules/lodash/_baseIsEqualDeep.js:24
/**
^^^

SyntaxError: Unexpected token ILLEGAL
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/vagrant/node_modules/lodash/_baseIsEqual.js:1:85)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/vagrant/node_modules/lodash/_baseIsMatch.js:2:19)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/vagrant/node_modules/lodash/_baseMatches.js:1:81)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/vagrant/node_modules/lodash/_baseIteratee.js:1:81)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/vagrant/node_modules/lodash/map.js:2:20)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/vagrant/node_modules/sazerac/lib/reducers/cases.js:11:12)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/vagrant/node_modules/sazerac/lib/reducers/store.js:5:14)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/vagrant/node_modules/sazerac/lib/reducers/actions.js:16:14)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/vagrant/node_modules/sazerac/lib/main.js:18:16)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/vagrant/test/importRowClassifier.js:11:10)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at /vagrant/node_modules/mocha/lib/mocha.js:219:27
    at Array.forEach (native)
    at Mocha.loadFiles (/vagrant/node_modules/mocha/lib/mocha.js:216:14)
    at Mocha.run (/vagrant/node_modules/mocha/lib/mocha.js:468:10)
    at Object.<anonymous> (/vagrant/node_modules/mocha/bin/_mocha:403:18)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:140:18)
    at node.js:1043:3

A fix for this would be welcome for anyone still using node 4.x I think!

mikec commented

@karlbecker I'm not seeing the issue using node 4.8.1. Also tried to repro with older versions of mocha (I think you're using 2.4.3?), and no luck there either. Might be related to the lodash dependency. Did you try blowing away /node_modules/ and fresh npm install? If that doesn't work, post your package.json, and test/importRowClassifier.js and I'll see if I can repro with that.

Sorry for the slow response!

Also tried to repro with older versions of mocha (I think you're using 2.4.3?)

2.4.5 here, should have mentioned that.

small chance, but https://github.com/mikec/sazerac/tree/v0.2.4 might fix it

The small chance has proven to 100% solve my issue ๐Ÿ˜Š

Bravo! ๐Ÿ‘ ๐Ÿ‘

Closing, since both 0.2.4 and 0.3.0 work fine for me here.

mikec commented

@karlbecker awesome! ๐Ÿ’ฅ