eslint-plugin-test-governance 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,16 @@ All notable changes to this project are documented here. The format follows
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.8.1] - 2026-10-22
10
+
11
+ ### Fixed
12
+
13
+ - In Playwright files, `const pw = require('@playwright/test')` and `import pw from '@playwright/test'`
14
+ are `test` itself, so `pw.skip(...)`, `pw.describe.fixme(...)` and `pw.test.skip(...)` are checked.
15
+ They were missed.
16
+ - In Mocha, Cypress and WebdriverIO files, `mocha.it.skip(...)` after `import mocha from 'mocha'` is
17
+ checked, as it already was after `import * as mocha from 'mocha'` and `require('mocha')`.
18
+
9
19
  ## [0.8.0] - 2026-10-22
10
20
 
11
21
  ### Added
@@ -347,7 +357,8 @@ First release.
347
357
  - Support for ESLint 9 and 10 flat config, JavaScript and TypeScript test files, `.extend()`
348
358
  fixtures, describe blocks, runtime skips and tags in titles or the `tag` option.
349
359
 
350
- [Unreleased]: https://github.com/Huldoser/eslint-plugin-test-governance/compare/v0.8.0...HEAD
360
+ [Unreleased]: https://github.com/Huldoser/eslint-plugin-test-governance/compare/v0.8.1...HEAD
361
+ [0.8.1]: https://github.com/Huldoser/eslint-plugin-test-governance/compare/v0.8.0...v0.8.1
351
362
  [0.8.0]: https://github.com/Huldoser/eslint-plugin-test-governance/compare/v0.7.0...v0.8.0
352
363
  [0.7.0]: https://github.com/Huldoser/eslint-plugin-test-governance/compare/v0.6.2...v0.7.0
353
364
  [0.6.2]: https://github.com/Huldoser/eslint-plugin-test-governance/compare/v0.6.1...v0.6.2
package/README.md CHANGED
@@ -302,8 +302,9 @@ In Playwright files:
302
302
  - `test` imported from `@playwright/test`, `playwright/test` or a component-testing package such as
303
303
  `@playwright/experimental-ct-react`, including the default import, aliases such as
304
304
  `import { test as it }` or `const it = test`, and `const { test } = require('@playwright/test')`.
305
- - `pw.test` on the whole module, after `import * as pw from '@playwright/test'` or
306
- `const pw = require('@playwright/test')`.
305
+ - `pw.test` on the whole module, after `import * as pw from '@playwright/test'`. The default import
306
+ and `const pw = require('@playwright/test')` are `test` itself, so `pw.skip(...)` and
307
+ `pw.test.skip(...)` both count.
307
308
  - Fixtures made with `.extend()` or `mergeTests()` in the same file, such as
308
309
  `const test = base.extend({...})`.
309
310
  - Any name in `testFunctions`, for fixtures imported from your own modules. The default `['test']`
@@ -322,7 +323,8 @@ In Mocha, Cypress and WebdriverIO files:
322
323
  - The globals `it`, `specify`, `describe` and `context`, their `x` forms, the TDD names `suite` and
323
324
  `test`, and the hooks `before`, `beforeEach`, `after`, `afterEach`, `suiteSetup`, `setup`,
324
325
  `suiteTeardown` and `teardown`.
325
- - The names imported or required from `mocha`, including aliases and `import * as mocha from 'mocha'`.
326
+ - The names imported or required from `mocha`, including aliases, and the whole module, as `mocha.it`
327
+ after `import * as mocha from 'mocha'`, `import mocha from 'mocha'` or `const mocha = require('mocha')`.
326
328
  - Any name in `testFunctions`, which defaults to `['it', 'specify', 'test']`.
327
329
 
328
330
  In `node:test` files:
@@ -138,7 +138,7 @@ function collectTestNames(program, framework, configured) {
138
138
  else if (spec.type === 'ImportDefaultSpecifier') {
139
139
  if (framework.defaultExport)
140
140
  roots.set(local, framework.defaultExport);
141
- // `import test from 'node:test'` also has `test.describe`.
141
+ // `import test from 'node:test'` also has `test.describe`, and `import mocha from 'mocha'` has `mocha.it`.
142
142
  if (framework.moduleIsDefault)
143
143
  modules.add(local);
144
144
  }
@@ -170,8 +170,8 @@ function collectTestNames(program, framework, configured) {
170
170
  else if (isOtherFramework(init))
171
171
  setOther(name);
172
172
  else {
173
- // `const pw = require('@playwright/test')`, used as `pw.test`, or `const test = require('node:test')`,
174
- // which is `test` itself.
173
+ // `const mocha = require('mocha')`, used as `mocha.it`, or `const pw = require('@playwright/test')`,
174
+ // which is `test` itself, as `require('node:test')` is.
175
175
  const source = requireSource(init);
176
176
  if (source !== undefined && framework.ownsModule(source)) {
177
177
  modules.add(name);
@@ -30,8 +30,8 @@ export interface Framework {
30
30
  /** What a default import from the framework's module is. */
31
31
  defaultExport?: Root;
32
32
  /**
33
- * Whether the module itself is its default export with the other functions as members, as
34
- * `require('node:test')`, which is `test` and has `test.describe`.
33
+ * Whether the default export is the module itself, with the other functions as members: node:test's and
34
+ * Playwright's are `test`, which has `test.describe`, and Mocha's has `mocha.it`.
35
35
  */
36
36
  moduleIsDefault: boolean;
37
37
  /** Test functions that exist without an import, besides `testFunctions`. */
@@ -16,7 +16,7 @@ const playwright = {
16
16
  ownsModule: isPlaywrightModule,
17
17
  exports: new Map([['test', TEST]]),
18
18
  defaultExport: TEST,
19
- moduleIsDefault: false,
19
+ moduleIsDefault: true,
20
20
  globals: new Map(),
21
21
  testFunctions: ['test'],
22
22
  testMembers: new Set(['only', 'skip', 'fixme', 'fail']),
@@ -143,7 +143,7 @@ const MOCHA_EXPORTS = new Map([
143
143
  const mocha = {
144
144
  ownsModule: (source) => source === 'mocha',
145
145
  exports: MOCHA_EXPORTS,
146
- moduleIsDefault: false,
146
+ moduleIsDefault: true,
147
147
  globals: new Map([
148
148
  ...[...MOCHA_EXPORTS].filter(([name]) => name !== 'it' && name !== 'test'),
149
149
  ['context', DESCRIBE],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-test-governance",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "ESLint rules that require a ticket comment above skipped, fixme, todo and tagged Playwright, Jest, Vitest, Mocha, Cypress, WebdriverIO and node:test tests.",
5
5
  "keywords": [
6
6
  "eslint",