Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two describe blocks execute despite .only #1

Open
bahmutov opened this issue Sep 11, 2017 · 1 comment
Open

Two describe blocks execute despite .only #1

bahmutov opened this issue Sep 11, 2017 · 1 comment
Labels

Comments

@bahmutov
Copy link
Owner

bahmutov commented Sep 11, 2017

In branch https://github.com/bahmutov/effective-e2e-testing-with-cypress/tree/double-only

when I have in cypress/integration/todo-spec.js two describe blocks with one having .only both run.

describe.only('main features', function () {
  it('first spec', function () {})
})

describe('main features with assertions', function () {
  it('second spec', function () {})
})

The above should execute only "main features" but Cypress 0.20.0 has
screen shot 2017-09-11 at 4 38 33 pm
Here is the code bundled

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';

describe.only('main features', function () {
  it('first spec', function () {});
});

describe('main features with assertions', function () {
  it('second spec', function () {});
});

},{}]},{},[1]);

Notice that the first describe title is a substring of the second. If I change the first one, it will run correctly by itself

describe.only('main 2 features', function () {
  it('first spec', function () {})
})

describe('main features with assertions', function () {
  it('second spec', function () {})
})

and if I change second describe title it will run again two describe blocks

describe.only('main 2 features', function () {
  it('first spec', function () {})
})

describe('main 2 features with assertions', function () {
  it('second spec', function () {})
})
@bahmutov bahmutov added the bug label Sep 11, 2017
@bahmutov
Copy link
Owner Author

Probably Mocha 2.x issue, fixed in Mocha 3.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant