Skip to content

Stack overflow on Windows #77

@maxosprojects

Description

@maxosprojects

Platform: Windows 10
Atom: 1.29.0 x64
atom-mocha-test-runner: 1.0.0

Reproduce
Run tests with Ctrl-Alt-M

Expected
Tests run and results are displayed

Observed
Error pane shows up with the following error:

Uncaught RangeError: Maximum call stack size exceeded
    at normalizeStringWin32 (path.js:33:30)
    at Object.normalize (path.js:440:14)
    at Object.join (path.js:562:18)
    at closestPackage (file:///C:/Users/User/.atom/packages/mocha-test-runner/lib/context.coffee:25:14)
    at closestPackage (file:///C:/Users/User/.atom/packages/mocha-test-runner/lib/context.coffee:31:5)
    at closestPackage (file:///C:/Users/User/.atom/packages/mocha-test-runner/lib/context.coffee:31:5)
    at closestPackage (file:///C:/Users/User/.atom/packages/mocha-test-runner/lib/context.coffee:31:5)
    at closestPackage (file:///C:/Users/User/.atom/packages/mocha-test-runner/lib/context.coffee:31:5)
    .
    .
    .

Notes:
Apparently root check in closestPackage isn't supposed to work on Windows.

closestPackage = (folder) ->
  pkg = path.join folder, 'package.json'
  if fs.existsSync pkg
    folder
  else if folder is '/'
    null
  else
    closestPackage path.dirname(folder)

Suggested fix:

closestPackage = (folder) ->
  pkg = path.join folder, 'package.json'
  if fs.existsSync pkg
    folder
  else if folder is path.parse(folder).root
    null
  else
    closestPackage path.dirname(folder)

Will, probably, do a PR later.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions