Tests
This issue is supposed to be a tracker for tests. I think that tests deserve their own folder instead of a single file. Also, I would like to know which issues might be related/resolved with tests, IMO these are:
- #115
- #198
- #205
- #208
Anyway, if it's fine to use a tests folder, I could start a test branch :) The issue list is just to check. :v:
Sounds great! :tada:
I've tried to make some first test like this
var tape = require('tape')
var bankai = require('..')
var fs = require('fs')
var path = require('path')
tape('should render example', function (t) {
t.plan(1)
var assets = bankai(path.resolve(__dirname, '../example.js'))
var ws = fs.createWriteStream('bundle.js')
var jsStream = assets.js()
jsStream.on('end', function () {
t.equal(document.querySelector('h1').textContent, 'hello planet')
})
jsStream.pipe(ws)
})
I though that would be easy to run with tape-run, but it isn't :( I get the following error
Error: Cannot find module 'fsevents' from '/home/ubuntu/workspace/node_modules/watchify/node_modules/chokidar/lib'
at /home/ubuntu/workspace/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:46:17
at process (/home/ubuntu/workspace/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:173:43)
at ondir (/home/ubuntu/workspace/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:188:17)
at load (/home/ubuntu/workspace/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:69:43)
at onex (/home/ubuntu/workspace/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:92:31)
at /home/ubuntu/workspace/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:22:47
at FSReqWrap.oncomplete (fs.js:152:21)
internal/streams/legacy.js:59
throw er; // Unhandled stream error in pipe.
^
Error: javascript required
at Stream.<anonymous> (/home/ubuntu/workspace/node_modules/tape-run/node_modules/browser-run/index.js:35:34)
at _end (/home/ubuntu/workspace/node_modules/tape-run/node_modules/through/index.js:65:9)
at Stream.stream.end (/home/ubuntu/workspace/node_modules/tape-run/node_modules/through/index.js:74:5)
at Stream.method [as end] (/home/ubuntu/workspace/node_modules/tape-run/node_modules/browser-run/node_modules/duplexer/index.js:47:39)
at Stream.<anonymous> (/home/ubuntu/workspace/node_modules/tape-run/node_modules/throughout/index.js:7:25)
at _end (/home/ubuntu/workspace/node_modules/tape-run/node_modules/through/index.js:65:9)
at Stream.stream.end (/home/ubuntu/workspace/node_modules/tape-run/node_modules/through/index.js:74:5)
at Stream.onend (internal/streams/legacy.js:44:10)
at emitNone (events.js:110:20)
at Stream.emit (events.js:207:7)
Do you have any idea why is this happening? Should I open an issue in tape-run repo or try some different approach on tests?
@yoshuawuyts
Why are you using tape-run? That's meant for browser testing, but it looks like what you're testing could be done in pure node, no?
Oh yeah, what tim said. I believe fsevents is a C++ module which is the origin of that error (e.g. browserify won't have a good time bundling that haha)
On Thu, Jul 6, 2017 at 5:33 PM Tim Wisniewski [email protected] wrote:
Why are you using tape-run? That's meant for browser testing, but it looks like what you're testing could be done in pure node, no?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/choojs/bankai/issues/211#issuecomment-313432474, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWleptATL8nO_EViozRDEWrQ27hvSfBks5sLP5dgaJpZM4OMRi6 .
@timwis just because bankai creates code meant to run in the browser. I could directly check the content of each stream but that's browserify generated code so I though it could be easy with tape-run haha if you have a better idea I would love to hear it :)
@yoshuawuyts more than that, I think the fsevents is an OSX exclusive library, that's why it's usually an OptionalDependency, and I'm working on a linux machine...
Someone should rewrite watchify using https://github.com/mafintosh/recursive-watch haha; think it'd be way better / way faster to install too (:
On Thu, Jul 6, 2017 at 6:16 PM Yerko Palma [email protected] wrote:
@timwis https://github.com/timwis just because bankai creates code meant to run in the browser. I could directly check the content of each stream but that's browserify generated code so I though it could be easy with tape-run haha if you have a better idea I would love to hear it :)
@yoshuawuyts https://github.com/yoshuawuyts more than that, I think the fsevents is an OSX exclusive library, that's why it's usually an OptionalDependency, and I'm working on a linux machine...
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/choojs/bankai/issues/211#issuecomment-313444878, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWlekfbUQFALDab0WDiesb5oXizwijcks5sLQhSgaJpZM4OMRi6 .