godaddy / ekke

Ekke is a test runner for React-Native, it allows you to execute your test code directly on the device enabling you to test in the same environment as your production users.
MIT License
133 stars 9 forks source link

Support Windows Paths #20

Closed CaptainNic closed 5 years ago

CaptainNic commented 5 years ago

When running ekke from Windows, the source generated from the template file contains invalid require paths due to unescaped backslashes.

The following error is produced when the ekke cli attempts to create the test bundle on Windows:

error: bundling failed: Error: Unable to resolve module `ekke-ekke-ekke-ekkeSamplesekke estsexample.mocha.js` from `C:\projects\xxxxx\node_modules\ekke\api\tmp\1036ebee65e879343047194fba31798cdee8d503f5772c4d7943ef2ffa284961.js`: Module `ekke-ekke-ekke-ekkeSamplesekke       estsexample.mocha.js` does not exist in the Haste module map

The generated exports in ekke/api/tmp/1036ebee65e879343047194fba31798cdee8d503f5772c4d7943ef2ffa284961.js:

module.exports = {
  runner: require('mocha'),
  suites: function suites() {
    require("ekke-ekke-ekke-ekke\Samples\ekke\tests\example.mocha.js");
  }
}

With this patch, the exports in the template file are correctly generated as:

module.exports = {
  runner: require('mocha'),
  suites: function suites() {
    require("ekke-ekke-ekke-ekke\\Samples\\ekke\\tests\\example.mocha.js");
  }
}
3rd-Eden commented 5 years ago

That's a really good catch. I assumed the paths would be set correctly by Node, as it's uses the path utility for everything, but I guess I was wrong.

Thanks for taking the time to tracking this down and providing a patch as well.

3rd-Eden commented 5 years ago

Released in 1.1.0