Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests #211

Open
YerkoPalma opened this issue Jul 3, 2017 · 6 comments
Open

Tests #211

YerkoPalma opened this issue Jul 3, 2017 · 6 comments

Comments

@YerkoPalma
Copy link
Member

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:

Anyway, if it's fine to use a tests folder, I could start a test branch :) The issue list is just to check. ✌️

@yoshuawuyts
Copy link
Member

Sounds great! 🎉

@YerkoPalma
Copy link
Member Author

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

@timwis
Copy link
Member

timwis commented Jul 6, 2017

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?

@yoshuawuyts
Copy link
Member

yoshuawuyts commented Jul 6, 2017 via email

@YerkoPalma
Copy link
Member Author

@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...

@yoshuawuyts
Copy link
Member

yoshuawuyts commented Jul 7, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants