Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 28 2019 05:43
    renovate[bot] synchronize #61
  • Jan 28 2019 05:43

    renovate[bot] on major-karma

    chore(deps): update dependency … (compare)

  • Jan 28 2019 04:47

    renovate[bot] on lock-file-maintenance

    (compare)

  • Jan 28 2019 04:47

    renovate[bot] on master

    chore(deps): lock file maintena… (compare)

  • Jan 28 2019 03:57

    renovate[bot] on lock-file-maintenance

    chore(deps): lock file maintena… (compare)

  • Jan 28 2019 03:56
    renovate[bot] synchronize #61
  • Jan 28 2019 03:56

    renovate[bot] on major-karma

    chore(deps): update dependency … (compare)

  • Jan 28 2019 02:57

    renovate[bot] on lock-file-maintenance

    (compare)

  • Jan 28 2019 02:57

    renovate[bot] on master

    chore(deps): lock file maintena… (compare)

  • Jan 28 2019 01:55

    renovate[bot] on lock-file-maintenance

    chore(deps): lock file maintena… (compare)

  • Jan 25 2019 21:38
    renovate[bot] synchronize #61
  • Jan 25 2019 21:38

    renovate[bot] on major-karma

    chore(deps): update dependency … (compare)

  • Jan 25 2019 19:46

    renovate[bot] on major-jest-monorepo

    (compare)

  • Jan 25 2019 19:46

    renovate[bot] on master

    chore(deps): update dependency … (compare)

  • Jan 25 2019 15:44

    renovate[bot] on major-jest-monorepo

    chore(deps): update dependency … (compare)

  • Jan 24 2019 16:28
    EricRoos commented #56
  • Jan 23 2019 23:55
    renovate[bot] commented #61
  • Jan 23 2019 23:55
    renovate[bot] opened #61
  • Jan 23 2019 18:24

    renovate[bot] on major-karma

    chore(deps): update dependency … (compare)

  • Jan 21 2019 01:49

    renovate[bot] on lock-file-maintenance

    (compare)

Sergii Stotskyi
@stalniy
The latest version of this package has 2 bugs
You need to use version from master. I plan to publish new version on Sun
Till then just use github as dependency
For your usecase try to use a different constant name. As
global is a reserved word
If it won't work I will check this usecase on Sun. Currently don't have my laptop
Eugen Kuksa
@eugenk
I just tried it with the master version, but it has the same problem. I also renamed the import to bddLazyVar instead of global. The debugger shows this:
Screen Shot 2018-03-09 at 07.36.05.png
This is the relevant line in the package-lock.json:
    "bdd-lazy-var": {
      "version": "github:stalniy/bdd-lazy-var#6ea52f4964b0589fb87a9755f830a8eee3f86cf3",
Sergii Stotskyi
@stalniy

Hi @eugenk

I found where the issue is :)

You incorrectly run mocha
you created a new instance of mocha but didn't run it. And then tried to run that file using something like
mocha test.js
you need to do instead
mocha -u bdd-lazy-var/global test.js
if you want to use mocha programatically, read this wiki page https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically
eventually your file should look like this
'use strict';

const expect = require("chai").expect;
const { def } = require("bdd-lazy-var/global");

describe('Order', () => {
  def("foo", () => true);

  it('is true', () => {
    expect($foo).to.be.true;
  })
});
also I published a new version of this library with bug fixes, new feature and performance improvements
Eugen Kuksa
@eugenk
Ah, I see. I didn't know how to call mocha (the mocha call was abstracted away by swagger's swagger project test). I thought it would suffice to add the mocha-related lines to the test file, but now I understand that they don't belong there. Thanks! Now it works fine.
Dmitrii Maganov
@vonagam
Hi, @stalniy.
Thanks for bdd-lazy-var.
I have started using it long time ago.
It really helps keep tests clean and sane.
I had rails background, so i really liked bdd-lazy-var/rspec.
I know that it is now depreceated and not present in version 2.
So i still use version 1, but now there is mocha version 5 and i see messages about incorrect peer dependency version.
Is it possible to bump version 1 bdd-lazy-var with support for mocha 5?
(I am not asking for code changes, only adding "^5.0.0 ||" to mocha spec in package.json)
Sergii Stotskyi
@stalniy
Hi @vonagam rspec behavior is the default one in 2nd version :) so you should be able to upgrade with minor changes
Also 2nd version should work faster. You can check releases tab in GitHub for changelog
if it does not work for some reason I’ll be able to bump 1.x in a week. But better to upgrade to 2.x
Dmitrii Maganov
@vonagam
@stalniy
You mean "bdd-lazy-var/global" dialect?
Because i remember that i tried to switch to version 2 with global dialect, but there was some difference between version 1 spec and version 2 global which prevented me from upgrading.
Dmitrii Maganov
@vonagam
Just checked with current version 2 and there are no problems.
Hm... seems like it was a bug which was resolved since then (in version 2.2.0 specifically).
Sorry for bother, should have checked before.
Sergii Stotskyi
@stalniy
Yes, there were few bugs.
Dmitrii Maganov
@vonagam
it.only and it.skip are not present anymore because of redefinition in last update.
Sergii Stotskyi
@stalniy
ah, sorry. Will fix today!
Sergii Stotskyi
@stalniy
fixed in 2.4.1
@vonagam thanks for the quick feedback!
Dmitrii Maganov
@vonagam

Hm... still get error. Problem is in those lines:

context.it = ui.wrapIt(context.it);
context.it.only = ui.wrapIt(context.it.only);
context.it.skip = ui.wrapIt(context.it.skip);

context.it.only will be undefined on second line, because on first line context.it replaced with ui.wrap result, which does not have those.

(I mean it will be undefined on right side, after assignment context.it.only will be a function from wrap, but will throw because it wraps undefined)
Sergii Stotskyi
@stalniy
ah, of course... This is strange because I tested and it was fine on my side. Probably later I moved statement around
Sergii Stotskyi
@stalniy
@vonagam try 2.4.2 please. should work
Dmitrii Maganov
@vonagam
yeah, works now. as usual thanks for library and fast response.
Sergii Stotskyi
@stalniy
No problem. Sorry for improper testing. And thanks for the feedback!
Jordan Max
@jordantomax
Hi @stalniy I'm working on setting up bdd-lazy-var in a new project right now with Jest. When I try to set the global get and def functions, I get an error Cannot read property 'getEnv' of undefined, referring to jasmine. Is Jasmine a requirement?
Sergii Stotskyi
@stalniy
Hi
jasmine is not a requirement but jest is actually a fork of jasmine with minor mmodifications
previously jasmine was exposed as global variable in jest env
i Will need to check but renovate should update jest and run tests on new versions.
Jordan Max
@jordantomax
oh, I didn't know that! Sounds good.
It seems to work correctly when I import into an individual file but has trouble when I import it into a jest setup file. Maybe there's something specific to that situation?
Sergii Stotskyi
@stalniy
I will check it
Jordan Max
@jordantomax
Thank you
Jordan Max
@jordantomax
@stalniy I noticed that when using it with done as an argument to the callback that done is undefined (I'm using Jest). It seems that wrapIt is not providing the arguments. Is this intended behavior?
Sergii Stotskyi
@stalniy
I think this is a bug
Jordan Max
@jordantomax
Okay, got it
Will look into a fix
Sergii Stotskyi
@stalniy
Probably the main issue with is that testing frameworks checks for fn.length. So, you can’t just forward args. You will need to create 2 separate functions: one with argument and another without and then use some based on original it function.
You can can also use promise to overcome this issue
Jordan Max
@jordantomax
Yeah promise is a good quick fix. Okay, thanks for the tip.