Closed ghempton closed 11 years ago
Why was node's events library not working for you?
The test included here fails (a simple require 'events'
). Gives the same issue as I was having in CSR.
Ah, I see now. As of 0.10
, events
now depends upon child_process
, which hasn't been ported or made available for obvious reasons. When I add the test and run the tests, I get this output, which is much clearer:
$ git diff
diff --git i/test/core.coffee w/test/core.coffee
index d37b4951..cfef23c7 100644
--- i/test/core.coffee
+++ w/test/core.coffee
@@ -14,3 +14,7 @@ suite 'Node Core Libraries', ->
test 'querystring', ->
fixtures '/a.js': 'module.exports = require("querystring").parse("a=b").a'
eq 'b', bundleEvalSync '/a.js'
+
+ test 'events', ->
+ fixtures '/a.js': 'module.exports = require("events")'
+ ok bundleEvalSync '/a.js'
$ make test
node_modules/.bin/mocha --compilers coffee:coffee-script-redux -u tdd -R dot test/*.coffee
․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․
✖ 1 of 44 tests failed:
1) Node Core Libraries events:
Error: Core module "[redacted]/commonjs-everywhere/core/child_process.js" has not yet been ported to the browser
Sorry for the lack of clarity. The error in CSR is actually different than this one I realize. For some reason require 'events'
simply returns null in that case. Well regardless, this fix does fix the CSR issue.
@michaelficarra done
Thanks, @ghempton.
fixes michaelficarra/CoffeeScriptRedux#183