Coder Social home page Coder Social logo

meteor-mocha-web's People

Contributors

abernix avatar alanning avatar creepgin avatar hexsprite avatar jagill avatar jfols avatar jimmack1963 avatar johnthepink avatar kidsil avatar mad-eye avatar meonkeys avatar philcockfield avatar pipedreambomb avatar rissem avatar rossettistone avatar samhatoum avatar sanjosolutions avatar serut avatar skv-headless avatar taromero avatar twlcek avatar udnaan avatar yevgenko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

meteor-mocha-web's Issues

Velocity: needs to report files used

Hey @rissem,

I haven't checked this carefully, so if you think I'm wrong, let me know and I'll do better research. But a quick VelocityTestFiles.find().fetch() in my console does not show any mocha-web-files, but results are populating, so I think mocha-web is not reporting back the files it's using.

I'm thinking that's what I want to use to cause the "create sample tests" button to be presented, so I'll need this as part of that effort unless you think this should work differently.

'Arguments to path.resolve must be strings' error.

Running into this issue when trying to run tests.

When I try to run tests using meteor-mocha-web I get the following error:
While building package mocha-web: path.js:313:15: Arguments to path.resolve must be strings

I think this may have to do with the recent update of Meteor to version 0.6.6 Meteor is now using node 0.10. Other people with this issue said it was due to an older version of NPM. My systems NPM is up to date (v1.3.11) but NPM and node are packaged with Meteor so I don't think this matters.

Anyone else having this issue?

AssertionErrors from Meteor.call not very helpful

I'm doing some validation, so I'm writing Meteor Methods instead of using Model.Insert, etc. The problem is, when an assertion fails in an asynchronous test, I'm not told which test or suite (it or describe) is failing in the console.

I get a message back like this, but it contains no useful information to determine which test this feedback is coming from:

Exception while delivering result of invoking 'insertTransaction'
AssertionError {message: "expected 'Cause not found' to include 'Owner'", actual: "Cause not found", expected: undefined, operator: undefined, showDiff: false…}
actual: "Cause not found"
expected: undefined
message: "expected 'Cause not found' to include 'Owner'"
operator: undefined
showDiff: false
stack: "expected 'Cause not found' to include 'Owner'"

I guess it would be most useful if that stack property contained a call stack, or the name of the suite and test, or at least the file and line number that threw it.

When I say an async test, I mean one like this:

it 'accepts only numeric amounts', (done) ->
  Meteor.call "insertTransaction", newTran, (error, result) ->
      should.exist error
      error.details.should.contain "NaN"
      done()

Don't run tests in production

Add a safety check to the top of server.js that will bail unless the server is running in development mode. This would stop both the server side tests, the mirror and phantomJS from starting up.

Uncaught Error: No such template 'mochaTestReport'

This might be due to the documentation being outdated or me being retarded, and not understanding meteorite. Either way, I'm getting Uncaught Error: No such template 'mochaTestReport'.

I suspect that this is due to mocha-web not being installed at all, because if I run
mrt add mocha-web from the project directory
and then search for the string "mocha-web" in the project, it finds 0 matches.

This is the installation output I get:
mrt add mocha-web --verbose

Installing Meteor

branch: https://github.com/meteor/meteor.git#master

Installing smart packages

Resolving dependency tree

I don't have a smart.json or anything like that, just installed meteorite and I'm trying to use it on an existing project.

Skipping server side tests doesn't seem to work.

Looking at the mocha docs, it.skip('name', func) lets you skip specific specs. This doesn't seem to work on server side.

TypeError: Object function (name, func){                                             
  wrappedFunc = function(callback)              
    if (func.length == 0)                       
      func();                                   
      callback();                               
    }                                           
    else {                                      
      func(callback)                            
    }                                           
  }                                             

  boundWrappedFunction = moddedBindEnvironment( 
    throw err;                                  
  });                                           

  mochaExports[testFunctionName](name,boundWrappedFunction);            
} has no method 'skip'

Add arguement checks to publishers

We use the audit-argument-checks, and meteor-mocha-web throws an error when trying to make it's subscriptions: Error: Did not check() all arguments during publisher 'mochaServerSideTests'

Support mocha.opts file

I'm kinda puzzling over how to change the ui options to TDD (suite() -> setup()) instead of the default BDD (describe -> describe). According to the Mocha docs, you can use a test/mocha.opts file to set this. I've tried putting one in my tests/ folder but it's not helped.

Running tests server side

Hi! Great to see this effort - we have recently included quick-n-dirty testing support to observatoryjs.com (check out testing tab overthere, github is https://github.com/jhoxray/observatory) based on chai and very small subset of mocha-like syntax, but we'd much rather use the real thing. The only problem is that there we included both server and client side testing (all run inside the full Meteor app environment) so I was wondering if you have plans to add that. If not, would you be ok if we fork yours and play with it to see if any pull requests work? Thanks!

  • J.

Error on 0.6.5

Hi guys,

Having just updated to the newly released 0.6.5 I'm getting a package build error at startup:

While building package `mocha-web`:
error: File not found: tests/_global.coffee
error: File not found: tests/auth_acl_spec.coffee
...

Are you seeing the same thing?
Thanks!

Data isolation?

Hey @rissem as far as I can tell, it looks like the tests written in mocha web run against the actual running version of the meteor app that was spun up?

I ask because this seems bad for data isolation, from a testing standpoint.

Global Leak!

When running the following test:

describe "Tests", ->
  describe "should work", ->
    it "loads chai and mocha", ->
      chai.expect(1+1).to.equal(2)

I get the following error:

Error: global leak detected: script1364333185006
    at Runner.checkGlobals (http://localhost:3000/packages/mocha-web/mocha.js?6063a59f4cc9bc796634b8496e4d619b5a6cd22d:4230:21)
    at Runner.<anonymous> (http://localhost:3000/packages/mocha-web/mocha.js?6063a59f4cc9bc796634b8496e4d619b5a6cd22d:4115:44)
    at Runner.EventEmitter.emit (http://localhost:3000/packages/mocha-web/mocha.js?6063a59f4cc9bc796634b8496e4d619b5a6cd22d:522:20)
    at http://localhost:3000/packages/mocha-web/mocha.js?6063a59f4cc9bc796634b8496e4d619b5a6cd22d:4461:14
    at Test.Runnable.run (http://localhost:3000/packages/mocha-web/mocha.js?6063a59f4cc9bc796634b8496e4d619b5a6cd22d:4049:5)
    at Runner.runTest (http://localhost:3000/packages/mocha-web/mocha.js?6063a59f4cc9bc796634b8496e4d619b5a6cd22d:4404:10)
    at http://localhost:3000/packages/mocha-web/mocha.js?6063a59f4cc9bc796634b8496e4d619b5a6cd22d:4450:12
    at next (http://localhost:3000/packages/mocha-web/mocha.js?6063a59f4cc9bc796634b8496e4d619b5a6cd22d:4330:14)
    at http://localhost:3000/packages/mocha-web/mocha.js?6063a59f4cc9bc796634b8496e4d619b5a6cd22d:4339:7
    at next (http://localhost:3000/packages/mocha-web/mocha.js?6063a59f4cc9bc796634b8496e4d619b5a6cd22d:4287:23)

Spin up PhantomJS

This package will now be responsible for using PhantomJS to run the client side tests. This should happen on code or test change.

Server side test - Must always run within a fiber error in before() hook

I'm trying to clear a meteor collection in before() hook, but it gives an Error: Meteor code must always run within a Fiber.
Stack trace:

Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment.
    at Object.Meteor._nodeCodeMustBeInFiber (packages/meteor/dynamics_nodejs.js:9)
    at Object.Meteor.bindEnvironment (packages/meteor/dynamics_nodejs.js:66)
    at null.<anonymous> (packages/meteor/helpers.js:108)
    at MongoConnection.(anonymous function) [as remove] (packages/mongo-livedata/mongo_driver.js:561)
    at Meteor.Collection.(anonymous function) [as remove] (packages/mongo-livedata/collection.js:451)
    at Context.<anonymous> (packages/mocha-web//home/vagrant/inviting/tests/server/sales.js:18)
    at Hook.Runnable.run (/home/vagrant/.meteorite/packages/mocha-web/mad-eye/meteor-mocha-web/5a681e206ad455d29a0e445caedc7bb1cbc12f47/.npm/package/node_modules/mocha/lib/runnable.js:221:32)
    at next (/home/vagrant/.meteorite/packages/mocha-web/mad-eye/meteor-mocha-web/5a681e206ad455d29a0e445caedc7bb1cbc12f47/.npm/package/node_modules/mocha/lib/runner.js:259:10)
    at Object._onImmediate (/home/vagrant/.meteorite/packages/mocha-web/mad-eye/meteor-mocha-web/5a681e206ad455d29a0e445caedc7bb1cbc12f47/.npm/package/node_modules/mocha/lib/runner.js:276:5)
    at processImmediate [as _immediateCallback] (timers.js:330:15)

My test code:

describe("Leaderboard", function() {
  describe("Player", function() {
    before(function() {
      Players.remove({});
    });

    it("can insert a player into the db", function(done) {
        // some test code
    });
  });
});

I looked at serverPreTest.js and I think the problem is in the wrapping function. In mocha, the 'it' function has different signature than 'before', 'beforeEach', 'after', and 'afterEach' function, so I don't think they can be combined in one wrapping function.

Calling Meteor Methods - "Method not found"

Scenario

In the following scenario:

Meteor.methods
  'foo': ->
    console.log 'foo method'


describe 'Meteor methods', ->
    it 'calls', (done) ->
      Meteor.call 'foo', (err, result) ->
        console.log 'callback', err
        done()

The method runs client-side, then the following error is returned:

Meteor.Error {error: 404, reason: "Method not found", details: undefined} 

I'm guessing this is the way the test files are being added conditionally, and maybe are not being added in a way where the server registers these methods. ??

Use-Case

Having this work would be very helpful. It would allow server-side setup of collections for testing which becomes very difficult the moment autopublish is turned off.

Thanks!

Exception in starting Velocity

Seeing this when I start velocity

I20140602-19:42:27.926(-7)? MOCHA-WEB MIRROR LISTENING AT http://localhost:53502/
I20140602-19:42:27.949(-7)? Running mocha-web server tests
I20140602-19:42:27.960(-7)? Exception in callback of async function: TypeError: Bad argument
I20140602-19:42:27.960(-7)?     at ChildProcess.spawn (child_process.js:923:24)
I20140602-19:42:27.960(-7)?     at exports.spawn (child_process.js:723:9)
I20140602-19:42:27.960(-7)?     at Object.exports.execFile (child_process.js:607:15)
I20140602-19:42:27.960(-7)?     at packages/mocha-web/server.js:49
I20140602-19:42:27.960(-7)?     at runWithEnvironment (packages/meteor/dynamics_nodejs.js:89)

Tests not reactive

Due to the way tests are no copied to the rsync mirror, changes to test files are no longer triggering reloads.

The solution will be to use velocity's file watching patterns.

Error on mrt add mocha-web during install

Hi,
When I tried running:
$ mrt add mocha-web

I got the following error:
Installing Meteor

branch: https://github.com/meteor/meteor.git#master

Installing smart packages

/usr/local/lib/node_modules/meteorite/node_modules/ddp/node_modules/ws/lib/WebSocket.js:175
else throw new Error('not opened');
^
Error: not opened
at WebSocket.send (/usr/local/lib/node_modules/meteorite/node_modules/ddp/node_modules/ws/lib/WebSocket.js:175:16)
at DDPClient._send (/usr/local/lib/node_modules/meteorite/node_modules/ddp/lib/ddp-client.js:77:15)
at WebSocket. (/usr/local/lib/node_modules/meteorite/node_modules/ddp/lib/ddp-client.js:49:10)
at WebSocket.EventEmitter.emit (events.js:92:17)
at WebSocket.establishConnection (/usr/local/lib/node_modules/meteorite/node_modules/ddp/node_modules/ws/lib/WebSocket.js:576:8)
at ClientRequest. (/usr/local/lib/node_modules/meteorite/node_modules/ddp/node_modules/ws/lib/WebSocket.js:488:25)
at ClientRequest.g (events.js:175:14)
at ClientRequest.EventEmitter.emit (events.js:106:17)
at CleartextStream.socketOnData (http.js:1587:11)
at CleartextStream.read as _read

Any ideas?

Thanks,

Erick

mocha-web CSS is interfering with app CSS

Excellent work on this package folks! The handful of CSS rules that affect the tag were interfering with my app's design. I've accounted for it in my CSS, but it would be nice to not have to do that. Specifically the lines are:

mocha.css 4-6
mocha.css 238-246

Not sure how crucial those rules are, but it sure would be nice if they didn't have to exist ;).

Make an easy way to load Collections with test data

Right now, the permissions for Collections often don't allow client-side insertions/deletions/etc. However, these are needed for a variety of test situations.

Currently I have to hack around them, but it would be very nice to have a supported way to safely allow test-data loading, such that:

  1. There is no security issues in production, and
  2. You don't unknowingly introduce changes in develop that break when they get to a production environment.

Tests not reactive

Due to the way tests are no copied to the rsync mirror, changes to test files are no longer triggering reloads.

The solution will be to use velocity's file watching patterns.

Error on Meteor 0.6.0 (require statement)

I'm getting an error on startup with 0.6.0, related to the changes around NPM and the require statement.

ReferenceError: require is not defined
    at null.on_use_handler (/Code/js/meteor/apps/respondly/.meteor/meteorite/packages/mocha-web/package.js:19:14)
    at _.extend.use (/.meteorite/meteors/timhaines/meteor/fce2a07e9a445dcdf3d2a7ef6f1d8b6d4c2e2205/tools/bundler.js:445:11)
    at self.api.use (/.meteorite/meteors/timhaines/meteor/fce2a07e9a445dcdf3d2a7ef6f1d8b6d4c2e2205/tools/bundler.js:114:21)
    at Array.forEach (native)

Thanks!

ReferenceError: assert is not defined?

Hi there!
Hey, I'm being a ditz, and can't seem to get this to work. I've installed mocha-web via mrt, set the environment variable, added {{> mochaTestReport }}, and gotten the HTML test runner (yay!). But then it spits out ReferenceError: assert is not defined.

Is this a Chai thing? I've tried various things like installing npm install chai and adding the line var assert = require("assert") to my test file. But nothing seems to be quite working.

Any ideas????
Thanks!

Sub-directory within tests folder causes error

If I have a sub-directory of within the tests folder, eg:

/root
  /tests
    /foo
      my_test.coffee

The following error occurs on startup:

    Errors prevented startup:
    Exception while bundling application:
    Error: EISDIR, illegal operation on a directory
        at Object.fs.readSync (fs.js:381:19)
        at Object.fs.readFileSync (fs.js:208:28)
        at _.extend.add_file (/Users/Phil/.meteorite/meteors/meteor/meteor/4d98d8cb4e5a95e9e98953f44c872c9332a042a3/app/lib/bundler.js:189:18)
        at self.api.add_files (/Users/Phil/.meteorite/meteors/meteor/meteor/4d98d8cb4e5a95e9e98953f44c872c9332a042a3/app/lib/bundler.js:96:16)
        at Array.forEach (native)
        at Function._.each._.forEach (/Users/Phil/.meteorite/meteors/meteor/meteor/4d98d8cb4e5a95e9e98953f44c872c9332a042a3/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
        at self.api.add_files (/Users/Phil/.meteorite/meteors/meteor/meteor/4d98d8cb4e5a95e9e98953f44c872c9332a042a3/app/lib/bundler.js:95:11)
        at Array.forEach (native)
        at Function._.each._.forEach (/Users/Phil/.meteorite/meteors/meteor/meteor/4d98d8cb4e5a95e9e98953f44c872c9332a042a3/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
        at Object.self.api.add_files (/Users/Phil/.meteorite/meteors/meteor/meteor/4d98d8cb4e5a95e9e98953f44c872c9332a042a3/app/lib/bundler.js:94:9)

Pending not working

if i try to make a pending test as :
describe("true", function(){ it('should return true') });
i get this error

Cannot read property 'length' of undefined TypeError: Cannot read property 'length' of undefined

Provide sample tests

The user should be able to press a button in the velocity-html-reporter and generate sample tests.

Phantom warning in console

I'm seeing this in the console upon using a fresh installation. Likely to go away when using iframes, but logging here in any case

PHANTOM-MOCHA-WEB: URLs that use the 'javascript:' protocol are not allowed in URL attribute values. Call UI._allowJavascriptUrls() to enable them.

Mocha displaying in template but not running tests

Hello!

I've followed all the steps in the README and in the example app but all it seems to be doing is inserting a div with an id of mocha into the DOM. It's not even running my tests.

Here is exactly what I'm typing in METEOR_MOCHA_TEST_DIR=tests meteor. Tried METEOR_MOCHA_TEST_DIR="tests" meteor as well as METEOR_MOCHA_TEST_DIR="tests" mrt.

Any thoughts? I'm using Meteor 0.7.0.1.

Double running iFrame

Currently the tests from within the velocity html reporter iFrame are being run twice resulting in two copies of every test result.

No reports in the example app

I can see the complete method being called, but the reports section is empty for mocha web. Is this because it's running in the mirror and doesn't have access to the main reports?

Realtime output from client side tests

Currently the phantomjs process is created with childProcess.execFile which returns all of the console output at once after the client side tests have finished running. It would be better to continually receive output as the client side tests run. This may be as easy as just switching to childProcess.spawn.

error: File not found: tests/test.coffee

I'm not sure what's going on for me, but I assume it's working for you now you've done the update to 0.6.5

However, for me, when I run my existing app that was using mocha-web and when I run a freshly pulled version of the demo repo:

https://github.com/mad-eye/leaderboard-mocha

I'm getting an error that looks like it's being emitted from the Meteor packer/linker when it attempts to pull all the packages together:

=> Running Meteor from a checkout -- overrides project version (0.6.5)

[[[[[ ~//TEMP/leaderboard-mocha ]]]]]

=> Errors prevented startup:

While building package `mocha-web`:
error: File not found: tests/test.coffee

Are you seeing anything like this? Thanks.

Velocity reporting: client vs. server

@rissem Does mocha-web have a way to mark test results as client or server when reporting to Velocity? Querying VelocityTestReports, it does not appear so. I'm thinking this would be useful to add so we can flag and sort results in the reporter.

does this support meteor 0.8.0?

<h1>Client Tests</h1>
<div>
  {{> mochaTestReport}}
</div>
<h1>Server Tests</h1>
<div>
  {{> serverTestReport}}
</div>

the test reports do not show up on meteor 0.8.0, only show up when i downgrade to 0.6.5.

Support client side tests

As is currently done for server side tests, use a custom mocha reporter to intercept test results and send them to velocity.

Caching on 0.6.5 - New test files not showing up.

We're seeing a situation where when we add a new test file, it does not show up in the list of executing tests.

The speculation is that this is because packages are now cached with the linker work that dropped in 0.6.5.

The new file is added, but perhaps the manifest of files dynamically created within the package.js file is cached, and that file-loading routine is not run again.

Something like this seems to be going on, because a change to a file within the mocha-web package itself causes the new test file to appear.

I've asked a question on the Meteor group about whether it's possible to declare a package as "do not cache", here:

https://groups.google.com/forum/?fromgroups#!topic/meteor-talk/aRvc-bYF8Bg

If that is possible, then that may be a simple answer to this.

Are you guys seeing the same behavior?

Make it possible to run mocha tests on the server

I realize this might be outside the scope of a package called "mocha-web", but I'd personally find it a lot more useful to run tests on the server than on the client (or in addition to on the client). Testing from the client means I have to deal with my Meteor methods doing XHRs and database writes and timing out and so on. If I could just call my methods from a server context, it would be a lot easier to make things run quickly and in isolation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.