npm / ini

An ini parser/serializer in JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mocha testing framework conflict

gri3v3r opened this issue · comments

When I am trying to run Mocha testing framework I receive the following error :

  > mocha --recursive

C:\nodejs\myproject\node_modules\ini\ini.js:76
    , lines = str.split(/[\r\n]+/g)
                  ^

TypeError: str.split is not a function
    at Object.decode (C:\nodejs\myproject\node_modules\ini\ini.js:76:19) 

I changed this part in the ini.js (around line 76 where the error is mentioned) :

  var out = {}
    , p = out
    , section = null
    , state = "START"
           // section     |key = value
    , re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i
    , lines = str.split(/[\r\n]+/g) //this is where the error occurs
    , section = null 

to this :

 var out = {}
    , p = out
    , section = null
    , state = "START"
           // section     |key = value
    , re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i
    , lines = [] 
    , str = str.toString() 
    , section = null

  if(str.length > 0)
  {
      lines = str.split(/[\r\n]+/g)
  } 

and the conflict gets resolved.

Have you ever used Mocha along with the module? Is it possible to include a fix for this?
You can include mine if you want.

Thank you in advance.

Looks like a bug in mocha. This module takes strings.