bdd-lazy-var: TypeError: suite.parent.appendOnlySuite is not a function

if i try to run mocha with an .only block, i get the following error:

express/node_modules/bdd-lazy-var/node_modules/mocha/lib/interfaces/common.js:132
          suite.parent.appendOnlySuite(suite);
                       ^
TypeError: suite.parent.appendOnlySuite is not a function
    at Object.create (express/node_modules/bdd-lazy-var/node_modules/mocha/lib/interfaces/common.js:132:24)
    at Object.only (express/node_modules/bdd-lazy-var/node_modules/mocha/lib/interfaces/common.js:96:21)
    at context.describe.only (express/node_modules/bdd-lazy-var/node_modules/mocha/lib/interfaces/bdd.js:69:27)
    at Function.detectSuite [as only] (express/node_modules/bdd-lazy-var/global.js:475:25)
    at Module.only

this only happens on 2.5.1

Example to reproduce:

Important note: if you install dependencies using yarn only!

describe.only("test suite", () => { // <--- error thrown here
  def("name", "John");

  it("works", () => {
    expect($name).to.equal("John");
  });

  context("nested suite", () => {
    it("also works", () => {
      expect($name).to.equal("John");
    });

    it("works as well", () => {
      expect(1).to.equal(1);
    });
  });
});

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 16 (12 by maintainers)

Commits related to this issue

Most upvoted comments

fixed in bdd-lazy-var@2.5.2

Found the cause of issue. This is dependency tree created by yarn:

├─ bdd-lazy-var@2.5.1
│  └─ mocha@6.1.4
└─ mocha@5.2.0

and this is tree from npm:

├─┬ bdd-lazy-var@2.5.1
│ └── mocha@5.2.0  deduped
└── mocha@5.2.0 

I use npm that’s why it was hard to reproduce the issue