Conversation
risantos
force-pushed
the
feature/node-test
branch
from
July 14, 2026 18:48
9020590 to
a9ba258
Compare
- Uses `TestContext` as `t`, with a JSDoc type assignment to prevent a TS error. - Add snapshots testing for exported configs
risantos
force-pushed
the
feature/node-test
branch
from
July 14, 2026 18:50
a9ba258 to
200b0c5
Compare
There was a problem hiding this comment.
Pull request overview
Adds first-class support for Node.js’s built-in test runner (node:test) by introducing a new nodeTest ESLint config (powered by eslint-node-test), and modernizes the repository’s test suite to use node:test’s TestContext assertions and snapshot testing.
Changes:
- Added
src/configs/nodetest.js, exported asnodeTest, and documented it in the README. - Migrated tests from
node:asserttoTestContextassertions and introduced/updated snapshot files. - Standardized dynamic plugin loading typings and updated test runner scripts (including snapshot update/watch helpers).
Reviewed changes
Copilot reviewed 34 out of 35 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Adds lock entries for eslint-node-test and quote-js-string. |
| test/src/utils/load-module.test.js | Migrates assertions to TestContext (t.assert.*). |
| test/src/rules/require-comment-punctuation.test.js | Converts tests to accept TestContext and uses t.assert (includes a no-op assertion). |
| test/src/rules/no-trailing-period-in-log-messages.test.js | Converts tests to accept TestContext and uses t.assert (includes a no-op assertion). |
| test/src/rules/index.test.js.snapshot | New snapshot for exported rules metadata. |
| test/src/rules/index.test.js | Switches “exported rules” test to snapshot-based assertion. |
| test/src/rules/database-migration-filename-format/index.test.js.snapshot | New snapshots for migration filename rule results. |
| test/src/rules/database-migration-filename-format/index.test.js | Migrates to TestContext assertions and snapshots for lint results. |
| test/src/configs/vitest.test.js.snapshot | New snapshots for Vitest config factory outputs. |
| test/src/configs/vitest.test.js | Migrates to TestContext assertions and snapshots. |
| test/src/configs/typescript.test.js.snapshot | New/updated snapshots for TypeScript config factory outputs. |
| test/src/configs/typescript.test.js | Migrates to TestContext assertions and adds snapshots; some assertions were replaced. |
| test/src/configs/nodetest.test.js.snapshot | New snapshots for Node test config factory outputs. |
| test/src/configs/nodetest.test.js | New tests covering createNodeTestConfig() behaviors. |
| test/src/configs/mocha.test.js.snapshot | New snapshots for Mocha config factory outputs. |
| test/src/configs/mocha.test.js | Migrates to TestContext assertions and snapshots. |
| test/src/configs/jest.test.js.snapshot | New snapshots for Jest config factory outputs. |
| test/src/configs/jest.test.js | Migrates to TestContext assertions and snapshots. |
| test/src/configs/javascript.test.js.snapshot | New snapshots for JavaScript config factory outputs. |
| test/src/configs/javascript.test.js | Migrates to TestContext assertions and snapshots. |
| test/src/configs/index.test.js.snapshot | New snapshot for config exports list (now includes nodeTest). |
| test/src/configs/index.test.js | Updates exports tests to include nodeTest and uses snapshots/TestContext. |
| test/index.test.js.snapshot | New snapshots for root exports and lint violation list. |
| test/index.test.js | Migrates to TestContext assertions and snapshots; updates exports test to include nodeTest. |
| src/utils/load-module.js | Updates dynamic import typing map for standardized “default vs module namespace” handling. |
| src/index.js | Re-exports nodeTest from src/configs/index.js. |
| src/configs/vitest.js | Simplifies dynamic plugin load typing and aligns loader util typing. |
| src/configs/typescript.js | Simplifies dynamic plugin load typing and aligns loader util typing. |
| src/configs/nodetest.js | Introduces new createNodeTestConfig() config factory using eslint-node-test. |
| src/configs/mocha.js | Simplifies dynamic plugin load typing and aligns loader util typing. |
| src/configs/jest.js | Simplifies dynamic plugin load typing and aligns loader util typing. |
| src/configs/index.js | Exports nodeTest config via top-level await factory invocation. |
| README.md | Documents the new nodeTest config and updates import examples. |
| package.json | Adds eslint-node-test (dev + optional peer), and adds test runner scripts for snapshots/watch. |
| eslint.config.js | Extends nodeTest config for repo tests and disables node-test/require-assertion in tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+10
to
+12
| * @param {object} [utils] - Optional utilities for dependency injection (for testing). | ||
| * @param {(moduleName: string) => boolean} utils.isModuleAvailable - Check if a module is available. | ||
| * @param {typeof loadModule} [utils.loadModule] - Dynamically load a module. |
Comment on lines
+45
to
+48
| process.emitWarning('`eslint-node-test` is not installed, Node test linting will be disabled', { | ||
| code: 'UPHOLD_ESLINT_NODE_TEST_PLUGIN_MISSING', | ||
| type: 'UpholdEslintWarning' | ||
| }); |
Comment on lines
+50
to
+52
| return defineConfig({ | ||
| name: 'uphold/empty-nodeTest' | ||
| }); |
Comment on lines
+262
to
263
| t.assert.snapshot(config[0]); | ||
| }); |
| 'no-trailing-period-in-log-messages', | ||
| 'require-comment-punctuation' | ||
| ]); | ||
| assert.snapshot(Object.entries(rules)); |
|
|
||
| - [Jest](https://jestjs.io/), depending on `eslint-plugin-jest`. | ||
| - [Mocha](https://mochajs.org/), depending on `eslint-plugin-mocha`. | ||
| - [Node.js built-in test runner (`node:test`)](https://nodejs.org/api/test.html), depending on `eslint-node-test` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
nodeTestESLint config for the Node.js built-in test runner (node:test), usingeslint-node-testas a peer dependency, and custom rules to accomodate ittest/index.test.jsto useTestContextassertions and snapshot testing instead ofassert, applying the newly exported rules.test:snapshot,test:watch)