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

[BUG] mocha-globals before/after hook functions no longer support a done function? #1007

Open
3 tasks done
Qard opened this issue Mar 7, 2024 · 1 comment
Open
3 tasks done
Labels
bug something not go good

Comments

@Qard
Copy link

Qard commented Mar 7, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Have you read the CONTRIBUTING guide on posting bugs, and CODE_OF_CONDUCT?

  • yes I read the things

This issue exists in the latest tap version

  • I am using the latest tap

Description

Prior to 18.x before/after functions accepted hook functions which took a callback to execute later. This functionality seems to have disappeared without any mention in the upgrade guide. Was this an intentional change?

Reproduction

before((done) => {
  setImmediate(done)
})

Environment

./node_modules/.bin/tap
dd-trace@6.0.0-pre /Users/stephen.belanger/Code/dd-trace-js
└── tap@18.7.0

tap: 18.7.0
"@tapjs/config": 2.4.15
"@tapjs/core": 1.5.0
"@tapjs/run": 1.5.0
"@tapjs/stack": 1.2.7
"@tapjs/test": 1.4.0
tap-parser: 15.3.1
tap-yaml: 2.2.1
tcompare: 6.4.5
plugins:
  "@tapjs/after": 1.1.18
  "@tapjs/after-each": 1.1.18
  "@tapjs/asserts": 1.1.18
  "@tapjs/before": 1.1.18
  "@tapjs/before-each": 1.1.18
  "@tapjs/filter": 1.2.18
  "@tapjs/fixture": 1.2.18
  "@tapjs/intercept": 1.2.18
  "@tapjs/mocha-globals": 1.1.18
  "@tapjs/mock": 1.3.0
  "@tapjs/node-serialize": 1.3.0
  "@tapjs/snapshot": 1.2.18
  "@tapjs/spawn": 1.1.18
  "@tapjs/stdin": 1.1.18
  "@tapjs/typescript": 1.4.0
  "@tapjs/worker": 1.1.18
# vim: set filetype=yaml :

# from .taprc
allow-incomplete-coverage: true
color: true
disable-coverage: true
node-arg:
  - --expose-gc
plugin:
  - "@tapjs/mocha-globals"

# env, cli, and defaults
coverage-report:
  - text
exclude:
  - "**/@(fixture*(s)|dist)/**"
include:
  - "**/@(test?(s)|__test?(s)__)/**/*.@(js|cjs|mjs|tap|cts|jsx|mts|ts|tsx)"
  - "**/*.@(test?(s)|spec).@(js|cjs|mjs|tap|cts|jsx|mts|ts|tsx)"
  - "**/test?(s).@(js|cjs|mjs|tap|cts|jsx|mts|ts|tsx)"
jobs: 8
mocha-globals: true
reporter: base
snapshot-clean-cwd: true
timeout: 30
@tapjs/after
@tapjs/after-each
@tapjs/asserts
@tapjs/before
@tapjs/before-each
@tapjs/filter
@tapjs/fixture
@tapjs/intercept
@tapjs/mock
@tapjs/node-serialize
@tapjs/snapshot
@tapjs/spawn
@tapjs/stdin
@tapjs/typescript
@tapjs/worker
@tapjs/mocha-globals
Darwin COMP-JX471G9FQQ 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:44 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6000 arm64 arm Darwin
@Qard Qard added the bug something not go good label Mar 7, 2024
@isaacs
Copy link
Member

isaacs commented Mar 8, 2024

Correct, this is a corollary of the fact that lifecycle methods don't get callbacks, they're just promise-returning.

Doc patch welcome, or I guess I'd be open to bringing that back, but tbh, it was always a bit flaky having it do both. Now it's closer to modern Mocha's type, where HookBlock is just () => void | any | Promise<void | any>

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

No branches or pull requests

2 participants