hsume2/browserify-rails — pull request #8 by dlindahl (2014-03-24 18:11:50+00:00)
Title: Support nested modules (and fix a intermittent test failure)

This adds support for requiring nested modules:

```javascript
// app.js
require('./foo')

// foo.js
require('./nested')

// nested/index.js
module.exports = TRUE
```

Previously, this would generate an "asset not found" error. I'm a little hazy on what the internals of `#evaluate` are doing with paths, but I think this is a decent enough attempt to solve the problem. At the very least, this provides a failing test case for you to improve upon.

Additionally, I made some improvements to the test code. It makes it easier to make changes to the expected output, slightly improves the failure output, and adds a fix for an intermittent test failure.

The test failure occurs when `foo.js` is modified within the same one second clock cycle as the initial test run. Sprockets can only detect modification times at a one second resolution, so if the file changes within that same one second window, Sprockets cannot tell that the file changes and thus uses its in-memory cached version which then fails the test.