deno icon indicating copy to clipboard operation
deno copied to clipboard

compat: tracking issue for running mocha test case

Open kt3k opened this issue 2 years ago • 7 comments

This issue tracks the progress of running the test cases of mocha repository.

test.node category

  • [x] run nps (task runner used in the repo)
  • [x] nps build failed because of zlib.gzip is not available. This can be resolved by https://github.com/denoland/deno_std/pull/1698
  • [x] npx nps test.node.bdd
  • [x] npx nps test.node.tdd
  • [x] npx nps test.node.qunit
  • [x] npx nps test.node.exports ~~blocked by #12648~~
  • [ ] npx nps test.node.unit
    • ~~blocked by #12648~~
    • TypeError: process.allowedNodeEnvironmentFlags is not iterable https://github.com/denoland/deno_std/pull/2049
    • should not pass if throwing async and test is async
      • https://github.com/mochajs/mocha/blob/ac43029d6a86150a48ccd59e50e89ca10c72a9c0/test/unit/throw.spec.js#L63
      • https://github.com/mochajs/mocha/blob/ac43029d6a86150a48ccd59e50e89ca10c72a9c0/test/unit/throw.spec.js#L111
      • https://github.com/mochajs/mocha/blob/ac43029d6a86150a48ccd59e50e89ca10c72a9c0/test/unit/throw.spec.js#L159
      • These test cases involve uncaught errors and deno can't run these test cases.
    • and other 25 assertion errors (needs investigations)
  • [ ] npx nps test.node.integration blocked by
    • [x] denoland/deno_std#1622
    • [x] also blocked by missing child_process.fork https://github.com/denoland/deno_std/issues/1690
    • [x] blocked by non informative error Error: null
    • [x] Uncaught TypeError: setInterval(...).unref is not a function in mocha/lib/nodejs/parallel-buffered-runner.js https://github.com/denoland/deno_std/pull/2038
    • [ ] Error: This script is intended to be run as a worker (by the workerpool package) in mocha/lib/nodejs/worker.js
      • workerpool.isMainThread boolean value is wrong
  • [ ] npx nps test.node.jsapi (2 failures) (related to uncaughtException handler)
    • Still adding/removing event listeners for not implemented events solve this issue https://github.com/denoland/deno_std/pull/2050
  • [x] npx nps test.node.requires Module.prototype.load causes Cannot set properties of undefined
  • [ ] npx nps test.node.reporters
    • ~~blocked by #12648~~
    • (20 assertion errors) Needs more investigation
  • [x] npx nps test.node.only
    • [x] npx nps test.node.only.bddRequire ~~blocked by #12648~~
    • [x] npx nps test.node.only.globalBdd
    • [x] npx nps test.node.only.globalTdd
    • [x] npx nps test.node.only.globalQunit

lint category

  • [x] npx nps lint.markdown doesn't work. Mocha depends on an ancient version of markdownlint-cli which depends on an ancient version of Commander which uses __proto__ in inheritance ref: https://github.com/tj/commander.js/blob/v2.3.0/index.js#L94
    • [x] I sent upstream an PR which updates the markdownlint-cli as it's a very old version, and doesn't seem worth support it in node-compat mode (mocha # 4795) Update: PR rejected but the maintainer addressed the issue in another PR
  • [ ] npx nps lint.code hangs without information. Needs more investigation

Other issus

(These issues need further works to identify what exactly causes them)

  • TypeError: Invalid signal: SIGBREAK
  • [x] Cannot find module 'https'
  • [x] mocha depends on fs-extra, which depends on fs.realpath.native

Known issues which block this task:

  • https://github.com/denoland/deno_std/issues/1630
  • https://github.com/denoland/deno_std/issues/1622
  • https://github.com/denoland/deno/issues/12648
  • https://github.com/denoland/deno_std/issues/1666
  • https://github.com/denoland/deno/issues/12999
  • https://github.com/denoland/deno/issues/13790

ref: #12577

kt3k avatar Nov 24 '21 07:11 kt3k

run nps (task runner used in the repo) blocked by std-1633

@kt3k there's no 1633 in deno_std, did you mean 1622 (setTimeout/setInterval)?

bartlomieju avatar Nov 24 '21 10:11 bartlomieju

@bartlomieju Oh, it was 1630. The tool nps stops on the error about process.binding('wrap_tty').TTY

$ deno run --compat --unstable -A node_modules/.bin/nps
error: Uncaught (in promise) TypeError: process.binding is not a function
  TTY = process.binding('tty_wrap').TTY,
                ^
    at Object.<anonymous> (file:///Users/kt3k/oss/mocha/node_modules/readline-sync/lib/readline-sync.js:19:17)

kt3k avatar Nov 25 '21 03:11 kt3k

#13553 resolved many issues in mocha compatibility!

kt3k avatar Mar 17 '22 06:03 kt3k

Here https://github.com/mochajs/mocha/blob/d7f6ea5f5d8406204053618c708634dbf5aa9670/lib/nodejs/parallel-buffered-runner.js#L14, mocha shadows setInterval in wrapper function scope with global one. It disables our providing-timers-in-wrapper-function hack 😬

kt3k avatar Mar 17 '22 06:03 kt3k

Maybe we can fake global object using Proxy 🤔

kt3k avatar Mar 17 '22 06:03 kt3k

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 31 '22 05:05 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 30 '22 15:07 stale[bot]

I was testing this with the alias node="deno run --compat --unstable", but now the commonjs entrypoint is not supported. So mocha's test case can't be run with the current compat behavior of Deno.

kt3k avatar May 11 '23 09:05 kt3k