Giter Club home page Giter Club logo

jasmine-fail-fast's People

Contributors

pmowrer 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

Watchers

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

jasmine-fail-fast's Issues

jasmine.getEnv is not a function

From the README usage guide:

var failFast = require('jasmine-fail-fast');
jasmine.getEnv().addReporter(failFast.init());

But for me the following worked:

jasmine.addReporter( failFast.init() );

My dev dependencies from package.json:

  "devDependencies": {
    "browserify": "^13.0.1",
    "chai": "^3.5.0",
    "chai-subset": "^1.3.0",
    "chokidar-cli": "^1.2.0",
    "cucumber": "^1.2.2",
    "http-server": "^0.9.0",
    "istanbul": "^1.1.0-alpha.1",
    "jasmine": "^2.4.1",
    "jasmine-fail-fast": "^2.0.0",
    "jsdom": "^9.4.1",
    "ts-node": "^0.9.3",
    "tsify": "^0.16.0",
    "typescript": "^1.8.10",
    "typings": "^1.3.1",
    "uglify-js": "^2.7.0"
  }

What file is the "global Jasmine environment"?

I trying to install it, but you say: "Add to the global Jasmine environment like so" I have no idea which jasmine file you are referring to. The documentation of jasmine also does not help at all and it seems that on the whole internet no one explains how to add a custom reporter to jasmine.

I do my angular tests with karma / jasmine and are getting ready for continuous integration, the fast-fail would help a lot, but I do not know where to call it.
In which file should I put the code?

Thanks.

Any interest in "optional" fail fast?

Usually, I only want to fail a test suite immediately if the setup steps lead to a failure -- such as "Can't find the predefined user in the database". There are other (less severe) cases where I want the test to continue -- such as "UI element was not styled Green for an active connection".

My proposed addition would add a setEnabled() function that would allow the user to specify at the spec level exactly which specs should fail fast. This would manipulate a private variable inside the module that would get reset back to "false" upon reaching the next spec in specStarted(). I've got working code, and if you are interested in merging it in, I'll fork a branch and submit it for review. Please let me know.

Thanks,
Stephen (Mr. City)

Documentation not clear how to configure as a helper for grunt-contrib-jasmine

I'm trying to get this into my grunt-contrib-jasmine config and I'm struggling to set it up as a helper. The documentation reads:

grunt-contrib-jasmine
Set up as a helper, optionally overriding the default helpers path.

I tried both listing the jasmine-fail-fast.js file directly as a helper in my Grunt config:

},
jasmine: {
  default: {
    src: ['<%= dirs.dest %>/<%= app.filename %>.js'],
    options: {
      summary: true,
      specs: 'specs/javascripts/*.js',
      ...
      helpers: [
        'node_modules/jasmine-fail-fast/dist/jasmine-fail-fast.js',
        ...
      ],
      vendor: [
      ...
      ],
      junit: {
        path: 'target/test-results/',
        consolidate: false
      }
    }
  }
},

as well as making a helper file that contained the snippet:

var failFast = require('jasmine-fail-fast');
jasmine.getEnv().addReporter(failFast.init());

I get ReferenceErrors either way, about 'require' or 'exports' not being defined, ostensibly because grunt-contrib-jasmine aren't running the helpers in a node context or whatever. Sorry, not sure what terminology to use :)

I'm using "grunt-contrib-jasmine": 1.0.1 which I believe runs Jasmine 2.2.0 by default.

Anyway, what am I missing in the docs?

Exports is not defined - using with grunt-contrib-jasmine

javascript
        jasmine: {
            test: {
                src: jasmineSrc,
                options: {
                    log: true,
                    summary: true,
                    display: 'none',
                    specs: [
                        'tests/**/*.spec.js'
                    ],
                    helpers: [
                        'node_modules/jasmine-fail-fast/dist/jasmine-fail-fast.js'
                    ]
                }
            }
        }
>> ReferenceError: Can't find variable: exports at
>> node_modules/jasmine-fail-fast/dist/jasmine-fail-fast.js:3

I am probably doing something wrong, and I guess it's not really a bug... but it is an issue :-)
How would I get this to work? Note that jasmineSrc is an array of files generated using my node-file-parser package https://bitbucket.org/skelware/node-file-parser/

Help would be appreciated, your package can save quite a lot of time upon test failure!

Library swallows exceptions thrown in afterAll

In case of an error during afterAll (probably also beforeAll) this reporter silently swallows the error while jasmine's exit code still is != 0. It manifests as follows, e.g.:

SUCCESS: 1 specs, 0 failures, 0 skipped, 0 disabled in 0.225s.
Warning: Task "jasmine_nodejs:unit_ci" failed. Use --force to continue.

In this case there was an error during an afterAll and no tests where executed. I understand there may be no spec to be marked as failed; however, other reporters still display the reason of the error at the end of the test output, e.g.:

Summary:

Suites:  136 of 136
Specs:   1 of 531 (530 disabled)
Expects: 0 (0 failures)
Finished in 0.314 seconds


>> An error was thrown in an afterAll
   Error: eee
     at handleError /Users/d049680/Code/bdh-objectservices/backend/test/jasmine/helpers/beforeTestHelper.js:176:11
     at runCallback timers.js:637:20
     at tryOnImmediate timers.js:610:5
     at processImmediate [as _immediateCallback] timers.js:582:5

Since there hasn't been upstream activity for quite some time I don't expect this to be fixed and instead just wanted to give a heads up to others running into this problem.

Initialization fails with Error: TypeError: Object #<Object> has no method 'describe_'

I've added the lib via protractor, but upon starting I receive the following error message and my tests immediately quit:

[launcher] Error: TypeError: Object #<Object> has no method 'describe_'
    at jasmine.Env.describe (/Users/philipp/entwicklung/sptablet-webapps/voucher-webapp/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:898:15)
    at [object Object].<anonymous> (/Users/philipp/entwicklung/sptablet-webapps/voucher-webapp/node_modules/jasmine-fail-fast/dist/jasmine-fail-fast.js:57:26)
    at [object Object].wrapper [as describe] (/Users/philipp/entwicklung/sptablet-webapps/voucher-webapp/node_modules/jasmine-fail-fast/node_modules/lodash/index.js:3592:19)
    at Object.exports.executeSpecs (/Users/philipp/entwicklung/sptablet-webapps/voucher-webapp/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/minijasminenode/lib/index.js:134:18)
    at /Users/philipp/entwicklung/sptablet-webapps/voucher-webapp/node_modules/grunt-protractor-runner/node_modules/protractor/lib/frameworks/jasmine.js:82:14
    at Function.promise (/Users/philipp/entwicklung/sptablet-webapps/voucher-webapp/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/q/q.js:650:9)
    at /Users/philipp/entwicklung/sptablet-webapps/voucher-webapp/node_modules/grunt-protractor-runner/node_modules/protractor/lib/frameworks/jasmine.js:63:14
    at _fulfilled (/Users/philipp/entwicklung/sptablet-webapps/voucher-webapp/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/q/q.js:797:54)
    at self.promiseDispatch.done (/Users/philipp/entwicklung/sptablet-webapps/voucher-webapp/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/q/q.js:826:30)
    at Promise.promise.promiseDispatch (/Users/philipp/entwicklung/sptablet-webapps/voucher-webapp/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/q/q.js:759:13)
[launcher] Process exited with error code 100

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.