cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Bond-Caron <>
Subject RE: Refactoring the CLI tests
Date Thu, 14 Nov 2013 19:02:50 GMT
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:

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:


// 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:

View raw message