Coder Social home page Coder Social logo

Comments (9)

jbblanchet avatar jbblanchet commented on July 29, 2024

Can't you just add it as a reporter in the options?

from gulp-jasmine.

DmitryEfimenko avatar DmitryEfimenko commented on July 29, 2024

I'd like to use default terminal reporter that comes with gulp-jasmine dependency.
If I write this:

.pipe($.jasmine({ verbose: true, reporter: failFast.init() }))

it'll override the default reporters.
I'd have to install terminal reporter separately and add it to array.

from gulp-jasmine.

jbblanchet avatar jbblanchet commented on July 29, 2024

I still think that it's preferable to exporting the jasmine object, especially since we are creating a new instance when you call $.jasmine(), so we couldn't export it before. I don't see a strong case for having 2 ways of adding reporters or configuring jasmine. Closing for now, feel free to discuss here some more if you feel differently.

from gulp-jasmine.

DmitryEfimenko avatar DmitryEfimenko commented on July 29, 2024

That's fine. Indeed it's not a strong case. Maybe it'll be worth reconsidering if other people feel the need in this for some different reasons.

from gulp-jasmine.

DmitryEfimenko avatar DmitryEfimenko commented on July 29, 2024

Actually that didn't work:

var failFast = require('jasmine-fail-fast');
var Reporter = require('jasmine-terminal-reporter');

var terminalReporter = new Reporter({
    isVerbose: true,
    showColors: true,
    includeStackTrace: false 
});

return gulp.src('./spec/*.js')
        .pipe($.jasmine({ reporter: [terminalReporter, failFast.init()] }));

The failFast.init() expects a global variable jasmine. It's probably not a design flaw. At least I'm not sure how I'd tweak failFast to avoid this issue.

Basically I don't know how to make this work without exporting jasmine from gulp-jasmine.

from gulp-jasmine.

jbblanchet avatar jbblanchet commented on July 29, 2024

And how about you implement it as a helper (https://github.com/Updater/jasmine-fail-fast#as-a-jasmine-helper)?

I'm not sure it'll work, I'm not that familiar with helpers, but I think helpers give you access to the jasmine instance.

from gulp-jasmine.

DmitryEfimenko avatar DmitryEfimenko commented on July 29, 2024

my understanding is that helpers are just a way of configuring the global jasmine object.
However, gulp-jasmine ignores global jasmine object. It creates a new instance of Jasmine.

Perhaps the whole thing would work if variable jasmine inside gulp-jasmine was declared like that:

var jasmine = jasmine || new Jasmine();

This way if there is a global jasmine variable, it'd be used instead of a fresh instance.

from gulp-jasmine.

jbblanchet avatar jbblanchet commented on July 29, 2024

@DmitryEfimenko My understanding is that helpers are 'reinstalled' every time we call jasmine.execute on te jasmine instance. That's the reason we are clearing them first. Let me know if you've tried it and it didn't work, but I'm pretty sure it should.

from gulp-jasmine.

DmitryEfimenko avatar DmitryEfimenko commented on July 29, 2024

you are right. I misunderstood what helpers are. It all worked.
For anyone who might need it, this is what the code looks like for me (besides adding the actual helper):

var terminalReporter = new TerminalReporter({ isVerbose: true, showColors: true, includeStackTrace: false });
gulp.src('./spec/*.js').pipe($.jasmine({
    reporter: [terminalReporter],
    config: { spec_dir: 'spec', helpers: ['./helpers/**/*.js'] }
}))

from gulp-jasmine.

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.