Skip to content

🐛 The node:test module unsupported map is marking nonexistant variables as supported/experimental #377

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

Closed
scagood opened this issue Nov 1, 2024 · 0 comments · Fixed by #378

Comments

@scagood
Copy link

scagood commented Nov 1, 2024

Enumerating the "OwnPropertyNames" of node:test module I have noticed that the current tree is rather wrong https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/unsupported-features/node-builtins-modules/test.js#L8-L48

import * as Test from 'node:test';
console.info(process.version);
console.info(Object.getOwnPropertyNames(Test));
$ node test.js
v22.11.0
[
  'after',   'afterEach',
  'before',  'beforeEach',
  'default', 'describe',
  'it',      'mock',
  'only',    'run',
  'skip',    'suite',
  'test',    'todo'
]

I think these need to be removed:

  • MockFunctionContext
  • MockModuleContext
  • MockTracker
  • MockTimers
  • TestsStream
  • TestContext
  • SuiteContext

MockTracker needs to be moved to its own and used as a constructed class on test.mock, eg like:

const MockTracker = {
  fn: { [READ]: { supported: [ "19.1.0", "18.13.0" ] } },
  getter: { [READ]: { supported: [ "19.3.0", "18.13.0" ] } },
  method: { [READ]: { supported: [ "19.1.0", "18.13.0" ] } },
  module: { [READ]: { experimental: [ "20.18.0" ] } },
  reset: { [READ]: { supported: [ "19.1.0", "18.13.0" ] } },
  restoreAll: { [READ]: { supported: [ "19.1.0", "18.13.0" ] } },
  setter: { [READ]: { supported: [ "19.3.0", "18.13.0" ] } },
}

However, the class at test.mock does not seem to match the MockTracker in the docs...

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

Successfully merging a pull request may close this issue.

1 participant