GithubHelp home page GithubHelp logo

Comments (32)

cscleison avatar cscleison commented on August 28, 2024 1

It's case sensitive. Try new jasmineReporters.TeamCityReporter()

from jasmine-reporters.

FlxRobin avatar FlxRobin commented on August 28, 2024

We're seeing the same issue with builds ran through Travis CI.

Yesterday our jasmine-node looked like:
[email protected] /home/travis/.nvm/v0.10.26/lib/node_modules/jasmine-node
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected] ([email protected], [email protected])

Today it looks like this (difference is in jasmine-reporters):
[email protected] /home/travis/.nvm/v0.10.26/lib/node_modules/jasmine-node
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected]
├── [email protected]
└── [email protected] ([email protected], [email protected])

from jasmine-reporters.

alanning avatar alanning commented on August 28, 2024

Although the error has "reporters" in it, I'd suspect this is something to do with this commit on the main jasmine-node repo:

mhevery/jasmine-node@9800757

Haven't isolated it yet but that section in the Teamcity constructor that references itself looks suspicious:

  jasmineNode.TeamcityReporter = function(config) {
    var callback_ = config.onComplete || false;

    (function(superFn) {
      jasmineNode.TeamcityReporter.prototype.reportRunnerResults = function(runner) {
        superFn.call(this, runner);
        if (callback_) {callback_(runner)}
      }
    }(jasmine.TeamcityReporter.prototype.reportRunnerResults));
  };
  jasmineNode.TeamcityReporter.prototype = new jasmine.TeamcityReporter;

source: https://github.com/mhevery/jasmine-node/blob/master/lib/jasmine-node/reporter.js#L330

I think that code only works if there is already a TeamcityReporter defined. Guessing there used to be another TeamcityReporter defined previously but the load order was changed so that it now gets defined later so this code now fails.

from jasmine-reporters.

sgrebnov avatar sgrebnov commented on August 28, 2024

+1, see the same issue

from jasmine-reporters.

angelsmercy avatar angelsmercy commented on August 28, 2024

+1, same issue.

from jasmine-reporters.

nirkoren avatar nirkoren commented on August 28, 2024

@FlxRobin , @alanning , @sgrebnov , @larrymyers , @angelsmercy
meanwhile, on order to overcome this issue until it fixed, just install [email protected]. Check the pom

node_modules/npm/bin/npm-cli.js
--proxy=${npm.proxy}
--https-proxy=${npm.proxy}
install
[email protected]

from jasmine-reporters.

alanning avatar alanning commented on August 28, 2024

Thanks @nirkoren. A user on SO also reported that reverting to v1.14.2 fixes this.

This supports the hypothesis that it is the commit I referenced above causing the issue.

from jasmine-reporters.

putermancer avatar putermancer commented on August 28, 2024

A primary issue here is that your jasmine-reporters version was bumped from 0.4 to 2.0. These are incompatible updates. Jasmine-reporters@ 0.4 and 1.0 support jasmine1.x and register themselves as "jasmine.REPORTERNAME", but when you get to 2.0 the reporters only support jasmine2 and are NOT registered on the "jasmine" object.

Try changing your package.json to use jasmine-reporters@<2.0.0 

Ben Loveridge (phone--sorry for typos)

On Thu, Jul 3, 2014 at 8:14 AM, Adrian Lanning [email protected]
wrote:

Thanks @nirkoren. A user on SO also reported that reverting to v1.14.2 fixes this.

This supports the hypothesis that it is the commit I referenced above causing the issue.

Reply to this email directly or view it on GitHub:
#63 (comment)

from jasmine-reporters.

alanning avatar alanning commented on August 28, 2024

Ok, I think I traced this down. This code in reporter.js needs to come after TeamcityReporter is defined:

  // Extend Teamcity Reporter
  jasmineNode.TeamcityReporter = function(config) {
    var callback_ = config.onComplete || false;

    (function(superFn) {
      jasmineNode.TeamcityReporter.prototype.reportRunnerResults = function(runner) {
        superFn.call(this, runner);
        if (callback_) {callback_(runner)}
      }
    }(jasmine.TeamcityReporter.prototype.reportRunnerResults));
  };
  jasmineNode.TeamcityReporter.prototype = new jasmine.TeamcityReporter;

source: https://github.com/mhevery/jasmine-node/blob/master/lib/jasmine-node/reporter.js#L326-L336

That code runs as soon as the reporter.js file is loaded...
...but in jasmine-node/index.js, the reporter.js file is loaded before TeamcityReporter is defined.

var nodeReporters = require('./reporter').jasmineNode;
jasmine.TerminalVerboseReporter = nodeReporters.TerminalVerboseReporter;
jasmine.TerminalReporter = nodeReporters.TerminalReporter;
jasmine.TeamcityReporter = nodeReporters.TeamcityReporter;

source: https://github.com/mhevery/jasmine-node/blob/master/lib/jasmine-node/index.js#L34-L37

To resolve this, I'd suggest that the "extending of TeamcityReporter" be moved from jasmine-node index.js into the jasmine-reporters repo proper.

from jasmine-reporters.

kacperus avatar kacperus commented on August 28, 2024

We've experienced exactly the same problem today. Downgrading "jasmine-node" version to "1.14.2" from "1.14.3" didn't solve the problem. Manually removing "[email protected]" and installing version "0.4.1" did the job.

from jasmine-reporters.

alanning avatar alanning commented on August 28, 2024

Published a fork of jasmine-node to npm in case anyone wants to use it temporarily until this gets fixed upstream.

jasmine-node-reporter-fix v0.0.2

It's a fork of jasmine-node v1.14.3 which includes a patch for getting junit reports working and also specifies jasmine-reporters@<2.0.0

from jasmine-reporters.

angelsmercy avatar angelsmercy commented on August 28, 2024

fixed for me, thank you.

from jasmine-reporters.

amoilanen avatar amoilanen commented on August 28, 2024

Until this problem is fixed as a workaround you can also go to the installed jasmine-node and comment out the TeamCity related code that causes this error:

In the file node_modules/jasmine-node/lib/jasmine-node/reporter.js in the end comment out:

/*
  // Extend Teamcity Reporter
  jasmineNode.TeamcityReporter = function(config) {
    var callback_ = config.onComplete || false;

    (function(superFn) {
      jasmineNode.TeamcityReporter.prototype.reportRunnerResults = function(runner) {
        superFn.call(this, runner);
        if (callback_) {callback_(runner)}
      }
    }(jasmine.TeamcityReporter.prototype.reportRunnerResults));
  };
  jasmineNode.TeamcityReporter.prototype = new jasmine.TeamcityReporter;
*/

This solved the problem for me.

from jasmine-reporters.

termie avatar termie commented on August 28, 2024

+1, same issue :/

from jasmine-reporters.

mochipful avatar mochipful commented on August 28, 2024

+1 same issue. Can we get an ETA?

We can't use any of these fixes because our test infrastructure is automated. We're using grunt-jasmine-node (https://github.com/jasmine-contrib/grunt-jasmine-node) which has a dependency on jasmine-node, so we can't directly patch in jasmine-reporters in package.json. And it doesn't make sense for grunt-jasmine-node to patch in a fix when jasmine-reporters is the problem.

Is there an ETA on when this issue will be resolved?

from jasmine-reporters.

nsk-mironov avatar nsk-mironov commented on August 28, 2024

@mochipful, We are using grunt-jasmine-node as well and we have found another workaround. Adding "jasmine-reporters": "~0.4" as a dependency to the root package.json solves the problem.

from jasmine-reporters.

nirkoren avatar nirkoren commented on August 28, 2024

Is anyone knows if this issue is about to be fixed soon?

from jasmine-reporters.

lukaszwit avatar lukaszwit commented on August 28, 2024

downgrade works for me

from jasmine-reporters.

vampserv avatar vampserv commented on August 28, 2024

downgrade only worked for me if I didn't use --junitreport flag with jasmine-node cli.

from jasmine-reporters.

mochipful avatar mochipful commented on August 28, 2024

@mironov-nsk You're a god. Thank you!
To test my own understanding... this works because grunt-jasmine-node -> jasmine-node ~1.7.1 -> jasmine-reporters >=0.2.0, and since jasmine-reporters 0.4.0 is already a dev dependency, it uses the existing package?

This is pretty cool. I had always thought that node_modules packages were sandboxed, but it makes a lot more sense to reuse the existing ones.

from jasmine-reporters.

nsk-mironov avatar nsk-mironov commented on August 28, 2024

@mochipful, yes, npm tries to avoid duplicate dependencies whenever possible.

from jasmine-reporters.

artkoshelev avatar artkoshelev commented on August 28, 2024

downgrade works for me

from jasmine-reporters.

ricardohbin avatar ricardohbin commented on August 28, 2024

downgrade works here too

from jasmine-reporters.

putermancer avatar putermancer commented on August 28, 2024

As has been noted, this is not a problem with jasmine-reporters, but instead is a problem with how the dependency in jasmine-node is defined (>=0.2.0, which is a very risky way to define dependencies). There are several pull requests to solve this in various ways inside jasmine-node, of which the best is probably mhevery/jasmine-node#333.

Thanks everyone for the tips on how to work around this issue until a proper fix has landed in jasmine-node. I am closing this issue. Please move further discussion and upvoting to mhevery/jasmine-node#333.

from jasmine-reporters.

henrytseng avatar henrytseng commented on August 28, 2024

throwing in a pull request for a downgrade! This is an important issue for us since we're running a CI environment

from jasmine-reporters.

ntobekoJ avatar ntobekoJ commented on August 28, 2024

I am still encountering this issue when using [email protected] together with [email protected]

Error thrown when trying to run jasmine-reporters:
C:\Users\Me\myProject\protractor.conf.js:25

jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter('outputdir/', true,
^
TypeError: undefined is not a function
at Object. (C:\Users\Me\myProject\protractor.conf.js:25:30)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at ConfigParser.addFileConfig (C:\Users\Me\AppData\Roaming\npm\node_mod
ules\protractor\lib\configParser.js:171:20)
at Object.init (C:\Users\Me\AppData\Roaming\npm\node_modules\protractor
\lib\launcher.js:30:18)
at Object. (C:\Users\Me\AppData\Roaming\npm\node_modules\pro
tractor\lib\cli.js:129:23)

from jasmine-reporters.

putermancer avatar putermancer commented on August 28, 2024

You will absolutely get an error when you try to use [email protected] with protractor -- in the example you just posted, you are trying to instantiating using [email protected] style, which leads to the undefined error you posted because the reporters are no longer defined on the global jasmine object. Protractor is jasmine 1.x only, so even if you used the correct syntax to create the reporter you wouldn't get the results you expect. —
Ben Loveridge (phone--sorry for typos)

On Wed, Sep 17, 2014 at 3:45 AM, ntobekoJ [email protected]
wrote:

I am still encountering this issue when using [email protected] together with [email protected]
Error thrown when trying to run jasmine-reporters:
C:\Users\Me\myProject\protractor.conf.js:25
jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter('outputdir/', true,
^
TypeError: undefined is not a function
at Object. (C:\Users\Me\myProject\protractor.conf.js:25:30)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at ConfigParser.addFileConfig (C:\Users\Me\AppData\Roaming\npm\node_mod
ules\protractor\lib\configParser.js:171:20)
at Object.init (C:\Users\Me\AppData\Roaming\npm\node_modules\protractor
\lib\launcher.js:30:18)
at Object. (C:\Users\Me\AppData\Roaming\npm\node_modules\pro

tractor\lib\cli.js:129:23)

Reply to this email directly or view it on GitHub:
#63 (comment)

from jasmine-reporters.

ntobekoJ avatar ntobekoJ commented on August 28, 2024

thanks Ben, so are you saying that I should rather be using vanilla webdriver?

from jasmine-reporters.

putermancer avatar putermancer commented on August 28, 2024

The primary reasons to use protractor over vanilla webdriver are a: it ties into the angular life cycle, so if you are using angular this is very convenient, and b: it modifies jasmine to understand webdriver promises, allowing you to write tests that look synchronous and are much cleaner and easier to follow. 

If you are using angular, I would recommend using protractor and [email protected]. If you need something from jasmine2, then you will need to use vanilla webdriver and write your tests using asynchronous patterns yourself -- in which can you can also use [email protected]

If you can get by with jasmine1.x, I think you will find you greatly prefer the protractor enhancements to jasmine over doing it in your own. 

Ben Loveridge (phone--sorry for typos)

On Wed, Sep 17, 2014 at 8:02 AM, ntobekoJ [email protected]
wrote:

thanks Ben, so are you saying that I should rather be using vanilla webdriver?

Reply to this email directly or view it on GitHub:
#63 (comment)

from jasmine-reporters.

ntobekoJ avatar ntobekoJ commented on August 28, 2024

Perhaps a new ticket is needed for this...my biggest issue is that version 1.x.x seems to no longer be available so I am unable to downgrade. Error: version not found: [email protected]

from jasmine-reporters.

charles-haynes avatar charles-haynes commented on August 28, 2024

Try 1.4?
On Sep 18, 2014 5:16 PM, "ntobekoJ" [email protected] wrote:

Perhaps a new ticket is needed for this...my biggest issue is that version
1.x.x seems to no longer be available so I am unable to downgrade. Error:
version not found: [email protected]


Reply to this email directly or view it on GitHub
#63 (comment)
.

from jasmine-reporters.

ntobekoJ avatar ntobekoJ commented on August 28, 2024

the major version 1.x.x is not available

npm ERR! notarget No compatible version found: jasmine@'>=1.0.0-0 <2.0.0-0'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["2.0.1"]

I have changed my implementation considering this limitation. I wonder though if this is not a cause for concern to the wider community

from jasmine-reporters.

Related Issues (20)

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.