On Thu Nov 7 11:40 AM, Braden Shepherdson wrote:
> The CLI tests are bad. I propose making them better.
> 
> I propose letting the tests actually run filesystem and related calls, 
> instead of
> always mocking them out. In the simplest form, that means running them on the
> real filesystem. If that's too slow, we can investigate other alternatives, 
> like using
> a ramdisk, or using that emulated fs that runs everything in RAM inside Node.
> 

Big +1, the cli tests are failing on windows:
https://issues.apache.org/jira/browse/CB-5330

Wouldn't be caught if it was mock tests.

For the emulated 'fs', it could be a proxy pattern to a file system on RAM:

e.g. 
testfs.setRoot('Z:\cordova-test');
testfs.init();   

// init() would remap every fs function
var fs = require('fs'), map = {'mkdir': fs.mkdirSync};

fs.mkdirSync = function (path, mode) {
  return map.mkdir(testfs.getPath(path), mode);
};

// using the default fs functions during tests is remapped to a virtual root 
path
fs.mkdirSync("C:\somewhere\cordova\foo"); // chmod 
'Z:\cordova-test\C\somewhere\cordova\foo '
fs.mkdirSync("/somewhere/cordova/foo");    // chmod 
'/mounted/tmpfs/somewhere/cordov/foo '

Tmpfs is great on unix, for Windows, I use:
http://www.softperfect.com/products/ramdisk/


Reply via email to