Giter VIP home page Giter VIP logo

meteor-community-packages / meteor-mocha Goto Github PK

View Code? Open in Web Editor NEW
67.0 14.0 38.0 778 KB

A Mocha test driver package for Meteor 1.3+. This package reports server AND client test results in the server console and can be used for running tests on a CI server or locally.

Home Page: https://packosphere.com/meteortesting/mocha

License: MIT License

JavaScript 96.79% Shell 3.01% HTML 0.19%
mocha testing jasmine meteor automated-testing hacktoberfest meteorjs

meteor-mocha's People

Contributors

aldeed avatar brookback avatar coagmano avatar denihs avatar dependabot[bot] avatar etyp avatar grubba27 avatar hexsprite avatar jankapunkt avatar jirikrepl avatar nachocodoner avatar simonsimcity avatar steventebrinke avatar storytellercz avatar sviande avatar thomasspiesser avatar wallyfaye 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

Watchers

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

meteor-mocha's Issues

Not display dates in console output

Thanks for a great package! Is there a way to get rid of the blue dates in the console output when running the tests so that the formatting looks a bit nicer?

meteortesting formatting

Showing server/ test results in browser?

I have the following tests in my folder structure:

imports/api/collections/a.test.ts
imports/api/collections/server/b.test.ts
imports/ui/client/c.test.ts

I run the tests with TEST_WATCH=1 meteor test --driver-package meteortesting:mocha.

The results for both server tests a.test.ts and b.test.ts are shown in the console under "RUNNING SERVER TESTS" .
But only the results for server test a and the client test c both show up in the tests at http://localhost:3000/. If I move the b.test.ts file into the collections folder it does show up.

Does anyone know why the subfolder tests aren't showing up or how to fix it? I tried MOCHA_GREP, but I seem to have the syntax wrong, because 'imports/**/*.ts' runs 0 tests?

Thanks!

Chrome window pops up when running "headless" in watch mode

Im running tests with this command:

TEST_BROWSER_DRIVER=chrome TEST_PARALLEL=1 TEST_WATCH=1 meteor test --driver-package meteortesting:mocha

Actual: While testing one or more blank windows pops up.
Expected: The tests should be executed headless, i.e. no window popping up.

Notes

  • The first window pops up with the url: "data:," the second with "localhost:3000"
  • Windows disappears after the tests have executed
  • Setting TEST_CLIENT=0 will not pop up the windows, i.e. problem with client tests

Web reporter for server tests

Can we add same web reporter for server tests as we do for client tests? It will be super convenient to run subset of tests from Web UI.

Client crash can cause tests to succeed

When the client crashes before executing any tests, meteor-mocha reports success (exit code 0), since no failing tests were performed. This can be reproduced with the following example code:

if (Meteor.isClient) throw new Error('Client only bug');
it('Failing on client', function() {
	assert.isTrue(Meteor.isServer);
});

Of course, this example is contrived, but for example importing files that are only available server side causes the same problem.

Error: Cannot find module 'chromedriver' while running test-packages

Hey !

I tryed to use this library to run tests of meteor-coverage but it looks like phantomjs can't do the job (can't write to global vars, dkw). I tryed to use chrome as a workaround but when I start the test, it fails on boot.

https://travis-ci.org/serut/meteor-coverage/builds/372737749

$ meteor npm test
> [email protected] test /home/travis/build/serut/meteor-coverage
> TEST_BROWSER_DRIVER=chrome COVERAGE=1 COVERAGE_OUT_LCOVONLY=1 COVERAGE_APP_FOLDER=$PWD/ meteor test-packages --once --settings .coverage.json --driver-package meteortesting:mocha
[[[[[ Tests ]]]]]
=> Started proxy.
=> Started MongoDB.
W20180429-17:26:09.371(0)? (STDERR) No packages under test in test-packages mode
W20180429-17:26:09.416(0)? (STDERR) { Error: Cannot find module 'chromedriver'
W20180429-17:26:09.417(0)? (STDERR)     at Function.Module._resolveFilename (module.js:547:15)
W20180429-17:26:09.417(0)? (STDERR)     at Function.resolve (internal/module.js:18:19)
W20180429-17:26:09.418(0)? (STDERR)     at Object.require (/tmp/meteor-test-run6vr4jh.xaojc/.meteor/local/build/programs/server/boot.js:288:32)
W20180429-17:26:09.418(0)? (STDERR)     at makeInstallerOptions.fallback (packages/modules-runtime.js:651:18)
W20180429-17:26:09.418(0)? (STDERR)     at require (packages/modules-runtime.js:244:16)
W20180429-17:26:09.419(0)? (STDERR)     at startChrome (packages/meteortesting:browser-tests/browser/chromedriver.js:30:5)
W20180429-17:26:09.419(0)? (STDERR)     at startBrowser (packages/meteortesting:browser-tests/server.js:23:7)
W20180429-17:26:09.419(0)? (STDERR)     at clientTests (packages/meteortesting:mocha/server.js:138:3)
W20180429-17:26:09.420(0)? (STDERR)     at serverTests (packages/meteortesting:mocha/server.js:168:7)
W20180429-17:26:09.420(0)? (STDERR)     at mochaInstance.run.failureCount (packages/meteortesting:mocha/server.js:118:13)
W20180429-17:26:09.421(0)? (STDERR)     at done (/home/travis/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.y1brx5.30jqo++os+web.browser+web.cordova/npm/node_modules/mocha/lib/mocha.js:497:13)
W20180429-17:26:09.421(0)? (STDERR)     at Runner.<anonymous> (/home/travis/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.y1brx5.30jqo++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:804:5)
W20180429-17:26:09.421(0)? (STDERR)     at emitNone (events.js:111:20)
W20180429-17:26:09.422(0)? (STDERR)     at Runner.emit (events.js:208:7)
W20180429-17:26:09.422(0)? (STDERR)     at /home/travis/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.y1brx5.30jqo++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:791:12
W20180429-17:26:09.423(0)? (STDERR)     at Runner.runSuite (/home/travis/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.y1brx5.30jqo++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:589:12) code: 'MODULE_NOT_FOUND' }
W20180429-17:26:09.423(0)? (STDERR) /home/travis/.meteor/packages/meteor-tool/.1.6.1_1.c76v6p.io9tw++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
W20180429-17:26:09.423(0)? (STDERR) 						throw(ex);
W20180429-17:26:09.424(0)? (STDERR) 						^
W20180429-17:26:09.424(0)? (STDERR) 
W20180429-17:26:09.424(0)? (STDERR) Error: When running app tests with TEST_BROWSER_DRIVER=chrome, you must first "npm i --save-dev [email protected] chromedriver"
W20180429-17:26:09.425(0)? (STDERR)     at startChrome (packages/meteortesting:browser-tests/browser/chromedriver.js:36:11)
W20180429-17:26:09.425(0)? (STDERR)     at startBrowser (packages/meteortesting:browser-tests/server.js:23:7)
W20180429-17:26:09.425(0)? (STDERR)     at clientTests (packages/meteortesting:mocha/server.js:138:3)
W20180429-17:26:09.426(0)? (STDERR)     at serverTests (packages/meteortesting:mocha/server.js:168:7)
W20180429-17:26:09.426(0)? (STDERR)     at mochaInstance.run.failureCount (packages/meteortesting:mocha/server.js:118:13)
W20180429-17:26:09.427(0)? (STDERR)     at done (/home/travis/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.y1brx5.30jqo++os+web.browser+web.cordova/npm/node_modules/mocha/lib/mocha.js:497:13)
W20180429-17:26:09.427(0)? (STDERR)     at Runner.<anonymous> (/home/travis/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.y1brx5.30jqo++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:804:5)
W20180429-17:26:09.427(0)? (STDERR)     at emitNone (events.js:111:20)
W20180429-17:26:09.428(0)? (STDERR)     at Runner.emit (events.js:208:7)
W20180429-17:26:09.428(0)? (STDERR)     at /home/travis/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.y1brx5.30jqo++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:791:12
W20180429-17:26:09.428(0)? (STDERR)     at Runner.runSuite (/home/travis/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.y1brx5.30jqo++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:589:12)
W20180429-17:26:09.429(0)? (STDERR)     at start (/home/travis/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.y1brx5.30jqo++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:789:10)
W20180429-17:26:09.429(0)? (STDERR)     at Runner.run (/home/travis/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.y1brx5.30jqo++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:816:5)
W20180429-17:26:09.430(0)? (STDERR)     at Mocha.run (/home/travis/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.y1brx5.30jqo++os+web.browser+web.cordova/npm/node_modules/mocha/lib/mocha.js:501:17)
W20180429-17:26:09.430(0)? (STDERR)     at serverTests (packages/meteortesting:mocha/server.js:111:17)
W20180429-17:26:09.430(0)? (STDERR)     at Object.start (packages/meteortesting:mocha/server.js:167:5)
I20180429-17:26:09.435(0)? 
I20180429-17:26:09.435(0)? --------------------------------
I20180429-17:26:09.436(0)? ----- RUNNING SERVER TESTS -----
I20180429-17:26:09.436(0)? --------------------------------
I20180429-17:26:09.436(0)? 
I20180429-17:26:09.436(0)? 
I20180429-17:26:09.437(0)? 
I20180429-17:26:09.437(0)?   0 passing (0ms)
I20180429-17:26:09.437(0)? 
I20180429-17:26:09.438(0)? 
I20180429-17:26:09.438(0)? --------------------------------
I20180429-17:26:09.438(0)? ----- RUNNING CLIENT TESTS -----
I20180429-17:26:09.438(0)? --------------------------------
=> Started your app.
=> App running at: http://localhost:3000/
npm ERR! Test failed.  See above for more details.
The command "meteor npm test" exited with 1.

The configuration :

  • package.js
Package.onTest(function (api) {
  api.use(['meteortesting:mocha']);
  Npm.depends({
    'chai': '2.1.0',
    'selenium-webdriver': '3.0.0-beta-2',
    'chromedriver': '2.38.2'
   });
  • package.json
"devDependencies": {
    "chromedriver": "^2.38.2",
    "selenium-webdriver": "3.0.0-beta-2"
  },

Any help would be much appreciated !

Run only from directory

I'm looking to limit tests finding to only the /imports/api directory of my app. Is there any way to do that with this package? I'm having a hard time finding a way to make that work. Right now it's discovering all tests in my /imports/ui and since the code isn't in client or server, limiting that way isn't going to work.

Throw Error on Chrome Tests

I tried to run the chrome tests and installed the advised package: "selenium-webdriver": "3.0.0-beta-2"

when i run the test with
SERVER_TEST_REPORTER=xunit XUNIT_FILE=$PWD/testresults/unit.xml TEST_BROWSER_DRIVER=chrome meteor test --once --driver-package meteortesting:mocha

i get this error after entering the RUNNING CLIENT TEST section:

/node_modules/selenium-webdriver/lib/promise.js:654
throw error;
^

Error: Server terminated early with status 127
at Error (native)
node_modules/selenium-webdriver/remote/index.js:243:22
...

No results in the browser

I am testing this package and I have one simple unit test, and I run in regular test mode (not full-app), but when I open the Meteor app in testing in the browser, I see results in the console, but no div is added anywhere in the DOM. (DOM is empty, besides script tags.)

Is there anything else one should do to see also results in the browser?

API for a webreporter

This is not my case. But if we are going to consolidate the packages, some people will miss web reporting. How could the raw mocha reporting data (not tap or spec sdtout) be exported to another module?

Garbled output on Meteor 1.7.0.3

I get garbled output both in the console and in the browser for Meteor 1.7.0.3 which includes meteortesting:mocha 2.4.5_6.

To repeat:

meteor create my-app
cd my-app
meteor add meteortesting:mocha
meteor test --driver-package meteortesting:mocha

I created a Stackoverflow question for this, and also provided what worked for me, which was to replace meteortesting:mocha with cultofcoders:mocha.

Nightmare error: Cannot redefine property: checkForMocha

Running: DEBUG=nightmare:*,electron:* TEST_BROWSER_VISIBLE=1 TEST_BROWSER_DRIVER=nightmare meteor test --once --driver-package dispatch:mocha

image

Error text:

W20170331-20:05:41.199(-4)? (STDERR) Sat, 01 Apr 2017 00:05:41 GMT nightmare:log page-error Uncaught TypeError: Cannot redefine property: checkForMocha TypeError: Cannot redefine property: checkForMocha
W20170331-20:05:41.199(-4)? (STDERR)     at Function.defineProperty (<anonymous>)
W20170331-20:05:41.200(-4)? (STDERR)     at http://localhost:3000/packages/dispatch_mocha.js?hash=675cf74bdc63891056f70555c56ced5b926f7894:171:12
W20170331-20:05:41.200(-4)? (STDERR)     at meteorInstall.node_modules.meteor.dispatch:mocha.browser-shim.js (http://localhost:3000/packages/dispatch_mocha.js?hash=675cf74bdc63891056f70555c56ced5b926f7894:260:3)
W20170331-20:05:41.200(-4)? (STDERR)     at fileEvaluate (http://localhost:3000/packages/modules-runtime.js?hash=0969a3165abf9612f4fb6ca11e39ddbae2c52756:207:9)
W20170331-20:05:41.200(-4)? (STDERR)     at Module.require (http://localhost:3000/packages/modules-runtime.js?hash=0969a3165abf9612f4fb6ca11e39ddbae2c52756:130:16)
W20170331-20:05:41.201(-4)? (STDERR)     at Module.Mp.import (http://localhost:3000/packages/modules.js?hash=aef70212e1542ba91afd8e478ebb1e86594f77bf:376:16)
W20170331-20:05:41.201(-4)? (STDERR)     at meteorInstall.node_modules.meteor.dispatch:mocha.client.js (http://localhost:3000/packages/dispatch_mocha.js?hash=675cf74bdc63891056f70555c56ced5b926f7894:48:14)
W20170331-20:05:41.202(-4)? (STDERR)     at fileEvaluate (http://localhost:3000/packages/modules-runtime.js?hash=0969a3165abf9612f4fb6ca11e39ddbae2c52756:207:9)
W20170331-20:05:41.202(-4)? (STDERR)     at require (http://localhost:3000/packages/modules-runtime.js?hash=0969a3165abf9612f4fb6ca11e39ddbae2c52756:130:16)
W20170331-20:05:41.202(-4)? (STDERR)     at http://localhost:3000/packages/dispatch_mocha.js?hash=675cf74bdc63891056f70555c56ced5b926f7894:1887:15
W20170331-20:05:41.375(-4)? (STDERR) Sat, 01 Apr 2017 00:05:41 GMT nightmare:log page-error Uncaught Error: Can't find test driver package: dispatch:mocha Error: Can't find test driver package: dispatch:mocha
W20170331-20:05:41.375(-4)? (STDERR)     at http://localhost:3000/packages/meteor.js?hash=27829e936d09beae3149ecfbf3332c42ccb1596f:1019:13
W20170331-20:05:41.376(-4)? (STDERR)     at maybeReady (http://localhost:3000/packages/meteor.js?hash=27829e936d09beae3149ecfbf3332c42ccb1596f:809:28)
W20170331-20:05:41.376(-4)? (STDERR)     at HTMLDocument.loadingCompleted (http://localhost:3000/packages/meteor.js?hash=27829e936d09beae3149ecfbf3332c42ccb1596f:821:5)
W20170331-20:05:41.376(-4)? (STDERR) Sat, 01 Apr 2017 00:05:41 GMT nightmare:log dom-ready [{}]
W20170331-20:05:41.376(-4)? (STDERR) Sat, 01 Apr 2017 00:05:41 GMT nightmare:log did-frame-finish-load [{},true]
W20170331-20:05:41.377(-4)? (STDERR) Sat, 01 Apr 2017 00:05:41 GMT nightmare:log did-finish-load [{}]
W20170331-20:05:41.377(-4)? (STDERR) Sat, 01 Apr 2017 00:05:41 GMT nightmare:log page-favicon-updated [{},["http://localhost:3000/favicon.ico"]]
W20170331-20:05:41.377(-4)? (STDERR) Sat, 01 Apr 2017 00:05:41 GMT nightmare:log did-stop-loading [{}]
W20170331-20:05:41.378(-4)? (STDERR) Sat, 01 Apr 2017 00:05:41 GMT nightmare:actions .wait() for fn

Full output:

https://gist.github.com/lorensr/4d7c1eeb6ab1d0750a88cc7c6ecccd8b

Code coverage support

I don't know how hard it is ... but I'd like to have support for code-coverage as some of my tests fail on phantomjs, so I can't really use spacejam on my project ๐Ÿ˜ข

[email protected] now requires Node 6

Per the README, I'm installing [email protected] because it supposedly doesn't require Node 6. But unfortunately that's not what yarn is telling me.

โ•ฐโ”€ยฑ nvm use default
Now using node v4.8.1 (npm v2.15.11)
โ•ญโ”€noah at MacBook-Pro in ~/Projects/app  (feature/...)
โ•ฐโ”€ยฑ yarn add [email protected] chromedriver --dev
yarn add v0.24.6
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
warning [email protected]: The engine "browser" appears to be invalid.
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=6.0".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

ignore scss imports

I have an issue with testing .jsx files which import .scss

directory-splash.jsx:

import React from 'react';                                                                                             
import PropTypes from 'prop-types';                                                                                    
import './directory-splash.scss';

export const DirectorySplash = ({backgroundImage, title}) => (                                                         
  (backgroundImage || title) ?
    <div className="directory-splash"                                                                                  
      style={backgroundImage ? {backgroundImage: `url(${backgroundImage})`} : null}                                    
    >
      <img className="directory-splash__image" src={backgroundImage} />                                                
      <h2 className="directory-splash__title">{title}</h2>                                                             
    </div> : null
);
DirectorySplash.propTypes = {
  backgroundImage: PropTypes.string,
  title: PropTypes.string,
};

export default DirectorySplash;

error output from meteor test:

W20170824-18:08:53.054(8)? (STDERR) Error: Cannot find module './directory-splash.scss'
W20170824-18:08:53.054(8)? (STDERR)     at makeMissingError (packages/modules-runtime.js:221:12)
W20170824-18:08:53.055(8)? (STDERR)     at require (packages/modules-runtime.js:231:19)
W20170824-18:08:53.055(8)? (STDERR)     at meteorInstall.imports.ui.components.directory-splash.directory-splash.jsx (imports/ui/components/directory-splash/directory-splash.jsx:1:210)
W20170824-18:08:53.055(8)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:333:9)
W20170824-18:08:53.055(8)? (STDERR)     at require (packages/modules-runtime.js:228:16)
W20170824-18:08:53.056(8)? (STDERR)     at meteorInstall.imports.ui.components.directory-splash.directory-splash.test.js (imports/ui/components/directory-splash/directory-splash.test.js:1:258)
W20170824-18:08:53.056(8)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:333:9)
W20170824-18:08:53.056(8)? (STDERR)     at require (packages/modules-runtime.js:228:16)
W20170824-18:08:53.057(8)? (STDERR)     at /private/var/folders/gk/7789rgc16wxbhv6tbw0tn7dh0000gr/T/meteor-test-run16w461j/.meteor/local/build/programs/server/app/app.js:14600:1
W20170824-18:08:53.057(8)? (STDERR)     at /private/var/folders/gk/7789rgc16wxbhv6tbw0tn7dh0000gr/T/meteor-test-run16w461j/.meteor/local/build/programs/server/boot.js:338:34

I wonder if there something similar to mocha --require ignore-styles - where ignore-styles is an npm package which skips imports of .scss files.

driver.manage(...).window(...).setPosition is not a function

meteor 1.6.1

meteor create app --bare
# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

[email protected]             # Packages every Meteor app needs to have
[email protected]       # Packages for a great mobile UX
[email protected]                   # The database Meteor supports right now
static-html             # Define static page content in .html files
[email protected]            # Reactive variable for tracker
[email protected]                 # Meteor's client-side reactive programming library

[email protected]   # CSS minifier run for production mode
[email protected]    # JS minifier run for production mode
[email protected]                # ECMAScript 5 compatibility for older browsers
[email protected]              # Enable ECMAScript2015+ syntax in app code
[email protected]            # Server-side component of the `meteor shell` command
meteortesting:mocha
{
  "name": "meteor-test-and-ci",
  "private": true,
  "scripts": {
    "start": "meteor run",
    "test": "TEST_BROWSER_DRIVER=chrome meteor test --once --driver-package meteortesting:mocha",
    "test-dev": "TEST_WATCH=1 meteor test --driver-package meteortesting:mocha"
  },
  "dependencies": {
    "@babel/runtime": "^7.0.0-beta.36",
    "meteor-node-stubs": "^0.3.2"
  },
  "devDependencies": {
    "chai": "^4.1.2",
    "chromedriver": "^2.35.0",
    "selenium-webdriver": "^4.0.0-alpha.1"
  }
}
TEST_BROWSER_DRIVER=chrome meteor test --once --driver-package meteortesting:mocha
=> App running at: http://localhost:3000/
    โœ“ should be true95(8)?
I20180227-15:36:58.495(8)?
I20180227-15:36:58.495(8)?
I20180227-15:36:58.495(8)?   1 passing (15ms)
I20180227-15:36:58.495(8)?
I20180227-15:36:58.495(8)?
I20180227-15:36:58.496(8)? --------------------------------
I20180227-15:36:58.496(8)? ----- RUNNING CLIENT TESTS -----
I20180227-15:36:58.496(8)? --------------------------------
W20180227-15:36:58.579(8)? (STDERR) meteor://๐Ÿ’ปapp/packages/meteortesting_browser-tests.js:133
W20180227-15:36:58.579(8)? (STDERR)   driver.manage().window().setPosition(20000, 20000); // We periodically grab logs from Chrome and pass them back.
W20180227-15:36:58.580(8)? (STDERR)                            ^
W20180227-15:36:58.580(8)? (STDERR)
W20180227-15:36:58.580(8)? (STDERR) TypeError: driver.manage(...).window(...).setPosition is not a function
W20180227-15:36:58.580(8)? (STDERR)     at startChrome (packages/meteortesting:browser-tests/browser/chromedriver.js:45:28)
W20180227-15:36:58.580(8)? (STDERR)     at startBrowser (packages/meteortesting:browser-tests/server.js:22:7)
W20180227-15:36:58.581(8)? (STDERR)     at clientTests (packages/meteortesting:mocha/server.js:120:3)
W20180227-15:36:58.581(8)? (STDERR)     at serverTests (packages/meteortesting:mocha/server.js:145:7)
W20180227-15:36:58.581(8)? (STDERR)     at mochaInstance.run.failureCount (packages/meteortesting:mocha/server.js:100:13)
W20180227-15:36:58.581(8)? (STDERR)     at done (/Users/monsterstep/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.1eq52gt++os+web.browser+web.cordova/npm/node_modules/mocha/lib/mocha.js:497:13)
W20180227-15:36:58.581(8)? (STDERR)     at Runner.<anonymous> (/Users/monsterstep/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.1eq52gt++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:804:5)
W20180227-15:36:58.582(8)? (STDERR)     at emitNone (events.js:111:20)
W20180227-15:36:58.582(8)? (STDERR)     at Runner.emit (events.js:208:7)
W20180227-15:36:58.582(8)? (STDERR)     at /Users/monsterstep/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.1eq52gt++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:791:12
W20180227-15:36:58.582(8)? (STDERR)     at /Users/monsterstep/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.1eq52gt++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:644:9
W20180227-15:36:58.582(8)? (STDERR)     at next (/Users/monsterstep/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.1eq52gt++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:284:14)
W20180227-15:36:58.582(8)? (STDERR)     at Immediate._onImmediate (/Users/monsterstep/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.1eq52gt++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:320:5)
W20180227-15:36:58.583(8)? (STDERR)     at runCallback (timers.js:789:20)
W20180227-15:36:58.583(8)? (STDERR)     at tryOnImmediate (timers.js:751:5)
W20180227-15:36:58.583(8)? (STDERR)     at processImmediate [as _immediateCallback] (timers.js:722:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! meteor-test-and-ci@ test: `TEST_BROWSER_DRIVER=chrome meteor test --once --driver-package meteortesting:mocha`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the meteor-test-and-ci@ test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/monsterstep/.npm/_logs/2018-02-27T07_36_58_731Z-debug.log

Can't run client tests with Chrome on Ubuntu

Hi,
When running this command: TEST_BROWSER_DRIVER=chrome TEST_WATCH=1 meteor test-packages ./packages/* --driver-package meteortesting:mocha --raw-logs,
I get the error below. This seems to be a config issue when setting up the Chrome driver.

TypeError: options.toCapabilities is not a function
    at startChrome (packages/meteortesting:browser-tests/browser/chromedriver.js:46:82)
    at startBrowser (packages/meteortesting:browser-tests/server.js:23:7)
    at clientTests (packages/meteortesting:mocha/server.js:138:3)
    at serverTests (packages/meteortesting:mocha/server.js:168:7)
    at mochaInstance.run.failureCount (packages/meteortesting:mocha/server.js:118:13)
    at done (/home/eric-burel/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.12nygdi.uqn4++os+web.browser+web.cordova/npm/node_modules/mocha/lib/mocha.js:497:13)
    at Runner.<anonymous> (/home/eric-burel/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.12nygdi.uqn4++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:804:5)
    at emitNone (events.js:111:20)
    at Runner.emit (events.js:208:7)
    at /home/eric-burel/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.12nygdi.uqn4++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:791:12
    at /home/eric-burel/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.12nygdi.uqn4++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:644:9
    at next (/home/eric-burel/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.12nygdi.uqn4++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:284:14)
    at Immediate._onImmediate (/home/eric-burel/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.12nygdi.uqn4++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:320:5)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)

Problem with server tests

Everything works well if I do

TEST_BROWSER_DRIVER='chrome' meteor test --driver-package dispatch:mocha

or:

TEST_SERVER=0 meteor test --once --driver-package dispatch:mocha

But if the command is:

meteor test --driver-package dispatch:mocha

I get:

I20170702-20:02:56.373(2)?                    
I20170702-20:02:56.374(2)? --------------------------------
I20170702-20:02:56.375(2)? ----- RUNNING SERVER TESTS -----
I20170702-20:02:56.376(2)? --------------------------------
I20170702-20:02:56.376(2)? 
I20170702-20:02:56.377(2)? 
I20170702-20:02:56.378(2)? 
I20170702-20:02:56.378(2)?   0 passing (0ms)
I20170702-20:02:56.380(2)? 
I20170702-20:02:56.381(2)? Load the app in a browser to run client tests, or set the 
TEST_BROWSER_DRIVER environment variable. See https://github.com/DispatchMe/meteor-
mocha/blob/master/README.md#run-app-tests
=> Exited with code: 0
=> Your application is crashing. Waiting for file change.

Could it be because all my describe are wrapped in if(Meteor.isClient)? There are no server tests right now.

mocha vs mocha-phantomjs

Hello, I'm working on getting my tests running on Travis CI, and I'm very confused about the relationship between dispatch:mocha and dispatch:mocha-phantomjs.

Could someone explain what these two (one?) packages do please?

Thanks.

Update or incorporate practicalmeteor:mocha-core

practicalmeteor:mocha-core hasn't been maintained since June 2016, It may be worth preventively updating the packages there.

It's not a big package, and I'm not sure if the separation of concerns is critical in this case. It may be worth incorporating it here. For example: Some features such as grep, or custom reporters would need patching to the practicalmeteor:mocha-core code.

Client tests in watch mode: Runner does not refresh on client changes

Does anyone else have an issue with client tests not re-running in watch mode?

I'm wondering if anyone can reproduce on their own stack.
Steps to reproduce:

  1. run the test runner:

TEST_WATCH=1 TEST_SERVER=0 TEST_BROWSER_DRIVER=nightmare meteor test --full-app --driver-package dispatch:mocha --port 9000

  1. Change a client file only
    Expected: full test suite to re-run.
    Actual: No change, just the standard print: '=> Client modified -- refreshing'

Any ideas?

App tests are passing on CI, but failing on local

Hi,

I am having an issue on Circle CI. When I run a command on the local machine, tests are failing (and they should), but when I run it on Circle CI, they are passing. For some reason, the package is always giving 0 exit code. The package works really good on packages test but fails on apps.

This is the command I am using:

TEST_CLIENT=0 meteor test --driver-package dispatch:mocha --once

Any idea what can be wrong here?

Run with --once but the test runner does not quit after finishing

I want to run the tests only once so that I can use it on a CI server. However, it just keep showing App running at: http://localhost:8000/ and no test was actually run

TEST_BROWSER_DRIVER=phantomjs TEST_SERVER=0 CLIENT_TEST_REPORTER=dot meteor test --once --driver-package dispatch:mocha --port 8000 --settings .settings/localhost.json
Using DSV custom oauth package               /
Using DSV custom oauth package               /
[[[[[ Tests ]]]]]

=> Started proxy.
=> Started MongoDB.

Unable to resolve some modules:

  "react/addons" in /Users/hungvo/Projects/songnhi/webapp/node_modules/enzyme/build/react-compat.js (web.browser)
  "react/lib/ReactContext" in /Users/hungvo/Projects/songnhi/webapp/node_modules/enzyme/build/react-compat.js (web.browser)
  "react/lib/ExecutionEnvironment" in /Users/hungvo/Projects/songnhi/webapp/node_modules/enzyme/build/react-compat.js (web.browser)
  "react-test-renderer/shallow" in /Users/hungvo/Projects/songnhi/webapp/node_modules/enzyme/build/react-compat.js (web.browser)

If you notice problems related to these missing modules, consider running:

  meteor npm install --save react react-test-renderer

W20170704-09:43:59.064(7)? (STDERR) Module load hook: transform [/private/var/folders/rp/0935lss16970__qmvmth8kzc0000gn/T/meteor-test-run1ar3j9v/.meteor/local/build/programs/server/app/app.js]
I20170704-09:44:07.272(7)? SKIPPING SERVER TESTS BECAUSE TEST_SERVER=0
=> Started your app.

=> App running at: http://localhost:8000/

Mocha anonymizes Errors in beforeEach/afterEach

I am currently setting up a testing environment for a project. Upon writing the very first test I received a very vague error:

Uncaught TypeError: Cannot read property 'replace' of undefined
    at Object.exports.clean (practicalmeteor_mocha-core.js?hash=daa1a30419e7324186e59f74d68a42f96a352274:5991)
    at Runner.<anonymous> (practicalmeteor_mocha-core.js?hash=daa1a30419e7324186e59f74d68a42f96a352274:2572)
    at Runner.EventEmitter.emit (practicalmeteor_mocha-core.js?hash=daa1a30419e7324186e59f74d68a42f96a352274:254)
    at Runner.<anonymous> (practicalmeteor_mocha-core.js?hash=daa1a30419e7324186e59f74d68a42f96a352274:2505)
    at Runner.EventEmitter.emit (practicalmeteor_mocha-core.js?hash=daa1a30419e7324186e59f74d68a42f96a352274:254)
    at Runner.fail (practicalmeteor_mocha-core.js?hash=daa1a30419e7324186e59f74d68a42f96a352274:4618)
    at Runner.failHook (practicalmeteor_mocha-core.js?hash=daa1a30419e7324186e59f74d68a42f96a352274:4647)
    at practicalmeteor_mocha-core.js?hash=daa1a30419e7324186e59f74d68a42f96a352274:4692
    at done (practicalmeteor_mocha-core.js?hash=daa1a30419e7324186e59f74d68a42f96a352274:4305)
    at Hook.Runnable.run (practicalmeteor_mocha-core.js?hash=daa1a30419e7324186e59f74d68a42f96a352274:4340)

I was for a long time unable to find out the problem, but after a while found out that this error gets thrown because I made a very simple and small mistake in the beforeEach function. In my code the mistake was handled by a custom error which is very specific and was made to help developing easier. Somehow Mocha translated it into the above error.

I tried testing a bit more why I got that error instead of my own error. The code of Mocha was complex, but it looks it has something to do with the error being caught, but the message not being passed well between functions so that once the clean function gets called the str parameter is undefined.

`mocha is not defined` error when MOCHA_GREP is used

I'm getting mocha is not defined error only when MOCHA_GREP with any string (i.e. MOCHA_GREP=billing) is used.

Full stack trace:

I20170424-00:05:57.168(7)? --------------------------------
I20170424-00:05:57.169(7)? ----- RUNNING SERVER TESTS -----
I20170424-00:05:57.169(7)? --------------------------------
I20170424-00:05:57.172(7)?
W20170424-00:05:57.192(7)? (STDERR) /Users/firfi/.meteor/packages/meteor-tool/.1.4.3_2.joqega++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
W20170424-00:05:57.192(7)? (STDERR) 						throw(ex);
W20170424-00:05:57.193(7)? (STDERR) 						^
W20170424-00:05:57.195(7)? (STDERR)
W20170424-00:05:57.196(7)? (STDERR) ReferenceError: mocha is not defined
W20170424-00:05:57.197(7)? (STDERR)     at serverTests (packages/dispatch:mocha/server.js:85:13)
W20170424-00:05:57.200(7)? (STDERR)     at Object.start (packages/dispatch:mocha/server.js:140:5)
W20170424-00:05:57.201(7)? (STDERR)     at packages/meteor.js:1044:27
W20170424-00:05:57.203(7)? (STDERR)     at Function.time (/private/var/folders/jl/7wz_34m90s96vfzc0_jjb5n00000gn/T/meteor-test-runthih7s/.meteor/local/build/programs/server/profile.js:309:28)
W20170424-00:05:57.203(7)? (STDERR)     at /private/var/folders/jl/7wz_34m90s96vfzc0_jjb5n00000gn/T/meteor-test-runthih7s/.meteor/local/build/programs/server/boot.js:312:13
W20170424-00:05:57.206(7)? (STDERR)     at /private/var/folders/jl/7wz_34m90s96vfzc0_jjb5n00000gn/T/meteor-test-runthih7s/.meteor/local/build/programs/server/boot.js:353:5
W20170424-00:05:57.208(7)? (STDERR)     at Function.run (/private/var/folders/jl/7wz_34m90s96vfzc0_jjb5n00000gn/T/meteor-test-runthih7s/.meteor/local/build/programs/server/profile.js:510:12)
W20170424-00:05:57.209(7)? (STDERR)     at /private/var/folders/jl/7wz_34m90s96vfzc0_jjb5n00000gn/T/meteor-test-runthih7s/.meteor/local/build/programs/server/boot.js:351:11

Meteor 1.4.x

How can we test-packages in a CI with chromedriver ?

sudo: false
addons:
  chrome: stable
language: node_js
node_js:
  - "8.9.1"
before_install:
  - curl https://install.meteor.com/?release=1.6 | /bin/sh
  - export PATH="$HOME/.meteor:$PATH"
  - meteor npm i --save-dev selenium-webdriver chromedriver
script:
  - TEST_BROWSER_DRIVER=chrome meteor --once test-packages --driver-package meteortesting:mocha ./

Output:

I20171126-23:47:34.314(0)? --------------------------------
I20171126-23:47:34.314(0)? ----- RUNNING CLIENT TESTS -----
I20171126-23:47:34.314(0)? --------------------------------
W20171126-23:47:34.337(0)? (STDERR) { Error: Cannot find module 'chromedriver'
W20171126-23:47:34.337(0)? (STDERR)     at Function.Module._resolveFilename (module.js:513:15)
W20171126-23:47:34.338(0)? (STDERR)     at Function.resolve (internal/module.js:18:19)
W20171126-23:47:34.338(0)? (STDERR)     at Object.require (/tmp/meteor-test-run1nqoqn7.xewu/.meteor/local/build/programs/server/boot.js:287:32)
W20171126-23:47:34.338(0)? (STDERR)     at makeInstallerOptions.fallback (packages/modules-runtime.js:641:18)
W20171126-23:47:34.338(0)? (STDERR)     at require (packages/modules-runtime.js:234:16)
W20171126-23:47:34.339(0)? (STDERR)     at startChrome (packages/meteortesting:browser-tests/browser/chromedriver.js:29:5)
W20171126-23:47:34.339(0)? (STDERR)     at startBrowser (packages/meteortesting:browser-tests/server.js:22:7)
W20171126-23:47:34.339(0)? (STDERR)     at clientTests (packages/meteortesting:mocha/server.js:119:3)
W20171126-23:47:34.339(0)? (STDERR)     at serverTests (packages/meteortesting:mocha/server.js:144:7)
W20171126-23:47:34.339(0)? (STDERR)     at mochaInstance.run.failureCount (packages/meteortesting:mocha/server.js:99:13) code: 'MODULE_NOT_FOUND' }

Any ideas, work arounds ? Thank you!

reporter output to a file

I am trying to use circle ci with my meteor app, however I need the reporter to write its output to a file, any clues how to accomplish this?
Thanks

CI for dispatch:mocha

This package should have it's own tests and run on CI. The irony is that it's very hard to test the test-drivers.
The easiest option may be having a blank meteor app in this repo, that has some tests, and run that app in meteor test mode.

It would be easier if this dispatch:moch had a --grep feature. Individual tests could be run to avoid running a full suite, and only being able to check pass/fail.

Add ENV to run server-client tests in series

To keep things quick, client tests are started at the same time as server tests. We can add something like TEST_SERIES=1 env variable for people who have bad tests that cause side effects.

Tests failing when looking for BrowserPolicy.content

We only use the browser-policy-framing package, which makes the check for Package['browser-policy-common'] pass, but since we don't use browser-policy-content we get the following error on test runs now:

W20180608-17:13:06.473(0)? (STDERR) TypeError: Cannot read property 'allowInlineStyles' of undefined
W20180608-17:13:06.473(0)? (STDERR)     at server.js (packages/meteortesting:mocha/server.js:13:25)

It happens because the check here assumes we're also using browser-policy-content though we're not. We didn't experience this before Meteor 1.7, which is odd.

It seems to me that this conditional should check for browser-policy-common AND browser-policy-content. Does that seem right?

Package test error

The command TEST_BROWSER_DRIVER=chrome meteor test-packages --driver-package dispatch:mocha fails with the error message Error: When running tests with TEST_BROWSER_DRIVER=chrome, you must first "npm i --save-dev selenium-webdriver chromedriver". I've already run this command and installed the dependencies. This seems like an issue with the way dependencies are loaded when using test-packages vs test. Do you have any ideas how to fix this issue?

Uncaught SyntaxError: Unexpected token { on import

code:

/* eslint-env mocha */
/* eslint-disable func-names, prefer-arrow-callback */

import { chai, assert } from 'meteor/meteortesting:mocha';

if(Meteor.isClient) {
    describe('Accounts', () => {
        it('should render', () => {
            const arr = ['foo', 'bar'];
            chai.assert(arr.length > 0, 'Arr length');
        });
    });
}

error:
Uncaught SyntaxError: Unexpected token {

Can't run Server/Client Only tests and can't integrate with Travis-CI

I'am trying to integrate my Meteor project into Travis CI. I've tried using practicalmeteor, but couldn't make it work on my console. Then, I've discovered meteor-mocha and everything worked out just fine on my console.

I'am having problems, though, with the TEST_CLIENT=0 command. It doesn't seem to change anything. My test script runs both on client and server.

Test script: "cli-test": "TEST_BROWSER_DRIVER=chrome meteor test TEST_CLIENT=0 --driver-package dispatch:mocha --once --settings settings-development.json"

It can be run like this: npm run cli-test. Although the console prints the script like I've written, meteor-mocha seems to ignore that and runs the tests on both platforms. The tests are executed correctly, without logging errors.

I'am trying to run server-only because I can't get Travis CI to work. Maybe the error showed bellow is related to client-testing on Travis. It keeps exiting with code 1 when Meteor is about to start.

Travis Logs

W20170502-23:20:40.330(0)? (STDERR) packages/modules.js:36207
W20170502-23:20:40.400(0)? (STDERR)   static createSession(...args) {}
W20170502-23:20:40.401(0)? (STDERR)                        ^^^
W20170502-23:20:40.401(0)? (STDERR) 
W20170502-23:20:40.402(0)? (STDERR) SyntaxError: Unexpected token ...
W20170502-23:20:40.403(0)? (STDERR)     at Object.exports.runInThisContext (vm.js:53:16)
W20170502-23:20:40.403(0)? (STDERR)     at /tmp/meteor-test-runh7fby/.meteor/local/build/programs/server/boot.js:289:30
W20170502-23:20:40.404(0)? (STDERR)     at Array.forEach (native)
W20170502-23:20:40.404(0)? (STDERR)     at Function._.each._.forEach (/home/travis/.meteor/packages/meteor-tool/.1.4.2_3.15i544++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20170502-23:20:40.405(0)? (STDERR)     at /tmp/meteor-test-runh7fby/.meteor/local/build/programs/server/boot.js:128:5
W20170502-23:20:40.405(0)? (STDERR)     at /tmp/meteor-test-runh7fby/.meteor/local/build/programs/server/boot.js:344:5
W20170502-23:20:40.405(0)? (STDERR)     at Function.run (/tmp/meteor-test-runh7fby/.meteor/local/build/programs/server/profile.js:480:12)
W20170502-23:20:40.406(0)? (STDERR)     at /tmp/meteor-test-runh7fby/.meteor/local/build/programs/server/boot.js:343:11
=> Started your app.
=> App running at: http://localhost:3000/
npm ERR! Linux 4.8.12-040812-generic
npm ERR! argv "/home/travis/.nvm/versions/node/v6.10.3/bin/node" "/home/travis/.nvm/versions/node/v6.10.3/bin/npm" "run" "cli-test"
npm ERR! node v6.10.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] cli-test: `TEST_BROWSER_DRIVER=chrome meteor test TEST_CLIENT=0 --driver-package dispatch:mocha --once --settings settings-development.json`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] cli-test script 'TEST_BROWSER_DRIVER=chrome meteor test TEST_CLIENT=0 --driver-package dispatch:mocha --once --settings settings-development.json'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the application-name package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     TEST_BROWSER_DRIVER=chrome meteor test TEST_CLIENT=0 --driver-package dispatch:mocha --once --settings settings-development.json
npm ๏ฟฝ[0mERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs application-name
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls application-name
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!     /home/travis/build/MarceloPrado/laPag/npm-debug.log
The command "npm run cli-test" exited with 1.
cache.2
store build cache
0.01s
12.73snothing changed, not updating cache
Done. Your build exited with 1.

Mine travis.yml


language: node_js
node_js:
  - "6"

install:
  # Install meteor
  - "curl https://install.meteor.com | /bin/sh"
  # Add meteor to path (instead of asking for sudo in the Travis container)
  # We can then use the faster container infrastructure - http://docs.travis-ci.com/user/workers/container-based-infrastructure/
  - "npm install"

cache:
  directories:
    - node_modules

before_script:
  - "export PATH=$HOME/.meteor:$PATH"

script:
  - "npm run cli-test"

Sorry for writing two issues on one post, I didn't know if they related somehow.

Thanks for attention!

TypeError when using chrome driver

Steps to reproduce:

  • meteor create app (version 1.6.1)
  • meteor add meteortesting:mocha
  • meteor npm i --save-dev selenium-webdriver chromedriver
$  TEST_BROWSER_DRIVER=chrome meteor test --once --driver-package meteortesting:mocha 
[[[[[ Tests ]]]]]                             

=> Started proxy.                             
=> Started MongoDB.                           
I20180223-19:48:25.236(-5)?                   
I20180223-19:48:25.541(-5)? --------------------------------
I20180223-19:48:25.542(-5)? ----- RUNNING SERVER TESTS -----
I20180223-19:48:25.542(-5)? --------------------------------
I20180223-19:48:25.542(-5)? 
I20180223-19:48:25.542(-5)? 
I20180223-19:48:25.543(-5)? 
I20180223-19:48:25.543(-5)?   0 passing (1ms)
I20180223-19:48:25.543(-5)? 
I20180223-19:48:25.543(-5)? 
I20180223-19:48:25.543(-5)? --------------------------------
I20180223-19:48:25.543(-5)? ----- RUNNING CLIENT TESTS -----
I20180223-19:48:25.544(-5)? --------------------------------
W20180223-19:48:26.683(-5)? (STDERR) /Users/me/.meteor/packages/meteor-tool/.1.6.1.18y0axr.54yj++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
W20180223-19:48:26.684(-5)? (STDERR)                                            throw(ex);
W20180223-19:48:26.684(-5)? (STDERR)                                            ^
W20180223-19:48:26.685(-5)? (STDERR) 
W20180223-19:48:26.685(-5)? (STDERR) TypeError: driver.manage(...).window(...).setPosition is not a function
W20180223-19:48:26.685(-5)? (STDERR)     at startChrome (packages/meteortesting:browser-tests/browser/chromedriver.js:45:28)
W20180223-19:48:26.685(-5)? (STDERR)     at startBrowser (packages/meteortesting:browser-tests/server.js:22:7)
W20180223-19:48:26.685(-5)? (STDERR)     at clientTests (packages/meteortesting:mocha/server.js:120:3)
W20180223-19:48:26.686(-5)? (STDERR)     at serverTests (packages/meteortesting:mocha/server.js:145:7)
W20180223-19:48:26.686(-5)? (STDERR)     at mochaInstance.run.failureCount (packages/meteortesting:mocha/server.js:100:13)
W20180223-19:48:26.686(-5)? (STDERR)     at done (/Users/me/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.x96wd2++os+web.browser+web.cordova/npm/node_modules/mocha/lib/mocha.js:497:13)
W20180223-19:48:26.686(-5)? (STDERR)     at Runner.<anonymous> (/Users/me/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.x96wd2++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:804:5)
W20180223-19:48:26.687(-5)? (STDERR)     at emitNone (events.js:111:20)
W20180223-19:48:26.687(-5)? (STDERR)     at Runner.emit (events.js:208:7)
W20180223-19:48:26.687(-5)? (STDERR)     at /Users/me/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.x96wd2++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:791:12
W20180223-19:48:26.687(-5)? (STDERR)     at Runner.runSuite (/Users/me/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.x96wd2++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:589:12)
W20180223-19:48:26.688(-5)? (STDERR)     at start (/Users/me/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.x96wd2++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:789:10)
W20180223-19:48:26.688(-5)? (STDERR)     at Runner.run (/Users/me/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.x96wd2++os+web.browser+web.cordova/npm/node_modules/mocha/lib/runner.js:816:5)
W20180223-19:48:26.688(-5)? (STDERR)     at Mocha.run (/Users/me/.meteor/packages/practicalmeteor_mocha-core/.1.0.1.x96wd2++os+web.browser+web.cordova/npm/node_modules/mocha/lib/mocha.js:501:17)
W20180223-19:48:26.688(-5)? (STDERR)     at serverTests (packages/meteortesting:mocha/server.js:98:17)
W20180223-19:48:26.689(-5)? (STDERR)     at Object.start (packages/meteortesting:mocha/server.js:144:5)
W20180223-19:48:26.689(-5)? (STDERR)     at packages/meteor.js:1107:27
W20180223-19:48:26.689(-5)? (STDERR)     at Function.time (/private/tmp/meteor-test-runreob4l.ntgdd/.meteor/local/build/programs/server/profile.js:309:28)
W20180223-19:48:26.689(-5)? (STDERR)     at /private/tmp/meteor-test-runreob4l.ntgdd/.meteor/local/build/programs/server/boot.js:427:13
W20180223-19:48:26.690(-5)? (STDERR)     at /private/tmp/meteor-test-runreob4l.ntgdd/.meteor/local/build/programs/server/boot.js:472:5
W20180223-19:48:26.690(-5)? (STDERR)     at Function.run (/private/tmp/meteor-test-runreob4l.ntgdd/.meteor/local/build/programs/server/profile.js:510:12)
W20180223-19:48:26.690(-5)? (STDERR)     at /private/tmp/meteor-test-runreob4l.ntgdd/.meteor/local/build/programs/server/boot.js:470:11
=> Started your app.

=> App running at: http://localhost:3000/
$

repro: https://github.com/lorensr/meteor-mocha-chrome-repro

Tests keep restarting without changing anything

Meteor: 1.6.0

TEST_BROWSER_DRIVER=chrome meteor test-packages --driver-package meteortesting:mocha packages/redis-oplog

Server keeps restarting:


I20171104-16:13:41.342(2)? --------------------------------
I20171104-16:13:41.342(2)? SERVER FAILURES: 0
I20171104-16:13:41.343(2)? CLIENT FAILURES: 0
I20171104-16:13:41.343(2)? --------------------------------
=> Exited with code: 0
I20171104-16:13:43.145(2)? RedisOplog - Established connection to redis.
I20171104-16:13:43.180(2)? 
I20171104-16:13:43.181(2)? --------------------------------
I20171104-16:13:43.181(2)? ----- RUNNING SERVER TESTS -----
I20171104-16:13:43.181(2)? --------------------------------

If I use TEST_WATCH=1 it works fine.

Meteor Todo App tests hanging with nightmare

Seems to work on another blank app with do nothing tests. But after using Meteor Todos app as a reference, some issues come up.

Server tests work fine, as expected.

Client app tests with --full-app worked once. Then on a second and subsequent runs it started hanging with no error after printing "client tests running". It's failing silently with no errors in 'debug'.

This command:
TEST_BROWSER_DRIVER=nightmare DEBUG=* meteor test --once --driver-package dispatch:mocha

Full App Tests and Server Start

Hello there,

I'm using dispatch:mocha to run full-app tests (and server unit tests) as I currently get phantomjs errors with dispatch:mocha-phantomjs.

I run my tests with:

meteor test --full-app --settings settings-ci.json --once --driver-package dispatch:mocha

My challenge is to wait for the server to fully initialize before the tests are launched. For instance, I use percolate:migrations to manage my schema and my migration scripts don't have time to finish before the full-app tests start running. I use Meteor.startup() to trigger my migrations as per this package documentation.

Still just a few weeks into Meteor. What would you recommend as a best practice, in a CI environment, to have the test suite wait on full server initialization before launching?

Many thanks for your contribution to Meteor! :-)

Remy

select: Invalid argument

TEST_BROWSER_DRIVER=phantomjs TEST_WATCH=1 meteor test-packages --driver-package dispatch:mocha ./
I20170302-11:37:23.006(2)? select: Invalid argument
I20170302-11:37:23.006(2)? select: Invalid argument
I20170302-11:37:23.007(2)? select: Invalid argument
I20170302-11:37:23.007(2)? select: Invalid argument
I20170302-11:37:23.007(2)? select: Invalid argument
I20170302-11:37:23.008(2)? select: Invalid argument
I20170302-11:37:23.008(2)? select: Invalid argument
I20170302-11:37:23.008(2)? select: Invalid argument
I20170302-11:37:23.008(2)? All client and server tests finished!
I20170302-11:37:23.008(2)? 
I20170302-11:37:23.008(2)? --------------------------------
I20170302-11:37:23.008(2)? SERVER FAILURES: 1
I20170302-11:37:23.009(2)? CLIENT FAILURES: null
I20170302-11:37:23.009(2)? --------------------------------

I simply can't get this to work..

Colooooooooooors

Why hello there and thank you for packaging mocha for Meteor in this awesome way.

Very important: Seems like the colors in CLI reporter are getting lost somewhere in translation.
This is how it could look:

image

I mean - how cool would that be?

Any chance it's easy to get them back?

Testing restivus endpoints with mocha

I'm trying to set up some test cases for my Restivus endpoints, while using dispatch:mocha package for the test runner.

Inside the test runner, I'm using the popular node Request library to get responses from the API. However I'm unexpectedly getting the whole meteor app payload, and not my specified response.

The test runner is run as per the meteor guide practices:

meteor test --driver-package dispatch:mocha --port 3000

describe('API', function ( ) {
it('sanity test', function (done) {
request({
method: "GET",
url: 'http://localhost:3000/api/anything'
}, function( err, res ){
console.log("callback url response: ", res);
done();
});
});
});
})
The result is a very large payload with js and css. Any thoughts on setting up tests for endpoints?

Same issue as : kahmali/meteor-restivus#223

Why do tests run slower than with `practicalmeteor:mocha`?

Hi guys,

I found that my test-suite runs much slower using this package (SERVER-side ONLY tests) than running them with practicalmeteor:mocha. It is NOT only this package - I have also tried practicalmeteor:mocha-xunit-reporter which is unusable as it hits the 120minute limit on CircleCi.

Here are some results:
dispatch:mocha OSX => 291 passing (26m)
dispatch:mocha CircleCi => NOT yet tested
practicalmeteor:mocha OSX => 263 passing (17m) // WINNER
practicalmeteor:mocha-xunit-reporter OSX => NOT yet tested
practicalmeteor:mocha-xunit-reporter CircleCi => hits the 120minutes limit (=UNUSABLE)

I am just wondering... maybe someone else is experiencing this too. And maybe someone finds a performance hack

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.