-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
type: buga defect, confirmed by a maintainera defect, confirmed by a maintainer
Description
Prerequisites
- Checked that your issue hasn't already been filed by cross-referencing issues with the
faqlabel - Checked next-gen ES issues and syntax problems by using the same environment and/or transpiler configuration without Mocha to ensure it isn't just a feature that actually isn't supported in the environment in question or a bug in your code.
- 'Smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, your usage of Mocha, or Mocha itself
- Ensured that there is no discrepancy between the locally and globally installed versions of Mocha. You can find them with:
node node_modules/.bin/mocha --version(Local) andmocha --version(Global). We recommend that you not install Mocha globally.
Description
Adding --watch means this.test.fullTitle() prepends a space (' ') on consecutive runs.
Steps to Reproduce
git clone https://gist.github.com/fatso83/d6ef639119bc497cbc8db2e2a950e441 name-issue
cd name-issue/
npm i
npm test
sleep 2;
touch demo.test.js
Will result in
1..1
ok 1 Outer TEST
# tests 1
# pass 1
# fail 0
1..1
not ok 1 Outer TEST
'Outer TEST' == ' Outer TEST'
AssertionError [ERR_ASSERTION]: 'Outer TEST' == ' Outer TEST'
at Context.<anonymous> (demo.test.js:7:16)
# tests 1
# pass 0
# fail 1
The actual test looks like this:
describe("Outer", function() {
it("TEST", (function() {
assert.equal('Outer TEST',this.test.fullTitle());
}));
});Expected behavior: [What you expect to happen]
No errors - the full title should stay the same
Actual behavior: [What actually happens]
A space gets prepended
Reproduces how often: [What percentage of the time does it reproduce?]
100%
Versions
6.0.2
$ mocha --version
6.0.2
$ node --version
v11.11.0
$ lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
Metadata
Metadata
Assignees
Labels
type: buga defect, confirmed by a maintainera defect, confirmed by a maintainer