Skip to content
This repository was archived by the owner on May 25, 2019. It is now read-only.

Tests fail on Windows (Cannot read property 'baseDirectory' of undefined) #10

@bretkikehara

Description

@bretkikehara

Example of stacktrace:

~\locator>npm test

> locator@0.3.3 pretest ~\locator
> jshint --config ./node_modules/yui-lint/jshint.json ./lib/ tests/lib/


> locator@0.3.3 test ~\locator
> mocha tests/lib/parseBundle.js --reporter spec



  BundleLocator.parseBundle()
    1) parseBundle()


  0 passing (253 ms)
  1 failing

  1) BundleLocator.parseBundle() parseBundle():
     TypeError: Cannot read property 'baseDirectory' of undefined
      at n.<anonymous> (~\locator\lib\bundleLocator.js:497:23)
      at new n (~\locator\node_modules\yui\promise\promise-min.js:1:2
28)
      at Object.BundleLocator._processFileQueue (~\locator\lib\bundle
Locator.js:486:16)
      at n.<anonymous> (~\locator\lib\bundleLocator.js:564:29)
      at ~\locator\node_modules\yui\promise\promise-min.js:1:1450
      at Object._onImmediate (~\locator\node_modules\yui\timers\timer
s-min.js:1:207)
      at processImmediate [as _immediateCallback] (timers.js:330:15)



npm ERR! weird error 1
npm ERR! not ok code 0

Issue in the code

Looking at the code, the build fails in bundleLocator.js on line 346 - 348. If I am reading the code correctly, the assumption is that paths will follow the Unix layout, hence the '/' check.

Inserting another condition, '\\' === findPath.charAt(bundlePath.length), will fix the Cannot read property 'baseDirectory' of undefined error, but the tests will not fully pass where actual is 26 and expected is 31.

~\locator>npm test

> locator@0.3.3 pretest ~\locator
> jshint --config ./node_modules/yui-lint/jshint.json ./lib/ tests/lib/


> locator@0.3.3 test ~\locator
> mocha tests/lib/parseBundle.js --reporter spec



  BundleLocator.parseBundle()
    1) parseBundle()


  0 passing (295 ms)
  1 failing

  1) BundleLocator.parseBundle() parseBundle():

      actual expected

      31 26





npm ERR! weird error 1
npm ERR! not ok code 0

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