Skip to content

Conversation

@wnghdcjfe
Copy link
Contributor

Test environment

  • nodeVersion : v10.15.1
  • os : MacOS

Description of the Change

I removed deprecated Method and tested it. removing something is difficult like love but it is neccessery

  • Mocha.prototype.ignoreLeaks
  • Mocha.prototype.useColors
  • Mocha.prototype.useInlineDiffs
  • Mocha.prototype.hideDiff

Mocha.prototype.ignoreLeaks

Why it is be removed?
because Mocha.prototype.checkLeaks is Take on a role and do better

Testing result

After I removed, It is worked

index.html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>Mocha Tests</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="https://unpkg.com/mocha/mocha.css" />
  </head>
  <body>
    <div id="mocha"></div>
    <script src="https://unpkg.com/chai/chai.js"></script>
    <script src="./mocha.js"></script> 
    <script class="mocha-init">
      mocha.setup('bdd');
      mocha.checkLeaks();
    </script>

    <script src="./a.js"></script> 
    <script class="mocha-exec">
      mocha.run();
    </script>
  </body>
</html>
a.js
const expect = chai.expect;
describe('Leak detection', function() {
  const test = () => {
    a = 1; 
  } 
  it('should not leak', function() {
    test(); 
  }) 
})

Testing npm start build && cp mocha.js ../test/public/
And it is work!

Mocha.prototype.useColors

We use color() instead of useColors().
Not a base.js - exports.useColors I removed Mocha.js - Mocha.prototype.useColors

Testing result

After I removed, It is worked
node ../../mocha/bin/mocha a.js --color
node ../../mocha/bin/mocha a.js --no-color

Mocha.prototype.useInlineDiffs

We use inlinediff() instead of useInlineDiffs();
After I removed, It is worked
node ../../mocha/bin/mocha a.js --inline-diffs

a.js
const {expect} = require('chai');  
describe("actual & expected Test", function () { 
  it("should results is same to expected", function () { 
    const results = {
      depth: 2,
      foo: "bar"
    }; 
    const expected = {
      depth: 4,
      foo: "bar",
      hello: "world"
    }; 
    expect(results).to.deep.equal(expected);
  });
});

Mocha.prototype.hideDiff

We use diff() instead of hideDiff();
After I removed, It is worked
node ../../mocha/bin/mocha a.js --diff=false
node ../../mocha/bin/mocha a.js --diff

a.js
const {expect} = require('chai');  
describe("actual & expected Test", function () { 
  it("should results is same to expected", function () { 
    const results = {
      depth: 2,
      foo: "bar"
    }; 
    const expected = {
      depth: 4,
      foo: "bar",
      hello: "world"
    }; 
    expect(results).to.deep.equal(expected);
  });
});

Let me know if there is anything I couldn't check. I'll fix it.

Benefits

Clean up for next version.

Remove following methods and cleanup.
- Mocha.prototype.ignoreLeaks
- Mocha.prototype.useColors
- Mocha.prototype.useInlineDiffs
- Mocha.prototype.hideDiff
@wnghdcjfe wnghdcjfe changed the title Remove deprecated method Remove deprecated methods Feb 5, 2020
@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 92.884% when pulling 90fcd53 on wnghdcjfe:gitmaster into 883ae4b on mochajs:master.

@juergba juergba added block semver-major implementation requires increase of "major" version number; "breaking changes" area: usability concerning user experience or interface labels Feb 5, 2020
@juergba juergba added this to the v8.0.0 milestone Feb 5, 2020
Copy link
Contributor

@juergba juergba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wnghdcjfe thank you for this PR!

Mocha is not yet ready for a major release, so the merging into master can take some time. Therefore I set the label block.

@eugenet8k
Copy link
Contributor

We use inlinediff() instead of useInlineDiffs();

False, it is actually inlineDiffs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: usability concerning user experience or interface semver-major implementation requires increase of "major" version number; "breaking changes"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants