Skip to content

CoffeeScript tests after v6.0.0 and suite return value check #3744

@wdavidw

Description

@wdavidw

Prerequisites

  • [x ] Checked that your issue hasn't already been filed by cross-referencing issues with the faq label
  • [x ] 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.
  • [x ] '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
  • [x ] 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) and mocha --version(Global). We recommend avoiding the use of globally installed Mocha.

Description

Issue #3243 shipped with v6.0.0 throw a deprecation warning or an error if --throw-deprecation is enabled with all CoffeeScript tests since the language support implicit returns.

Steps to Reproduce

The following minimalist test case:

describe 'My Suite', () ->
  it 'run a test', () ->
    console.log 'yes'

Throw the error "DeprecationWarning: Suites ignore return values. Suite "My Suite" in /package/test/my/test.coffee returned a value; this may be a bug in your test code"

A temporary workaround include returning undefined:

describe 'system.authconfig', () ->
  it 'fuck around', () ->
    console.log 'yes'
  undefined

Versions

  • The output of npx mocha --version : 6.0.0
  • The code transpiler being used: CoffeeScript
  • Other information not relevant

Additional Information

I understand the motivation behind #3243. One way to please everyone is to detect if the return value found in the suite is not the same as the one returned by it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: buga defect, confirmed by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions