Skip to content

Commit feb4561

Browse files
committed
test: add tests for commit messages with bodies
Adds test cases to verify that the `package-reference-format` commitlint rule only applies to commit subjects, not bodies. This confirms that including `@stdlib/` prefixes in commit message bodies (e.g., for breaking change descriptions) is acceptable. --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent fa922b5 commit feb4561

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

  • lib/node_modules/@stdlib/_tools/commitlint/rules/package-reference-format/test

lib/node_modules/@stdlib/_tools/commitlint/rules/package-reference-format/test/test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,22 @@ tape( 'the function returns `[ true, \'\' ]` for empty or missing subject', func
172172
t.deepEqual( result, [ true, '' ], 'returns expected value' );
173173
t.end();
174174
});
175+
176+
tape( 'the function only applies to commit subjects, not bodies', function test( t ) {
177+
var result;
178+
179+
// A valid subject with body containing `@stdlib/` prefix should pass:
180+
result = rule({
181+
'subject': 'remove: remove `dmax` from namespace',
182+
'body': 'This commit removes the `dmax` symbol from the `@stdlib/stats/base` namespace due to a package migration.\n\nBREAKING CHANGE: remove `dmax`\n\nTo migrate, users should access the same symbol via the `@stdlib/stats/strided` namespace.'
183+
}, 'always' );
184+
t.deepEqual( result, [ true, '' ], 'returns expected value' );
185+
186+
// A valid subject with body containing unquoted package paths should pass:
187+
result = rule({
188+
'subject': 'remove: remove `stats/base/dmax`',
189+
'body': 'This commit removes @stdlib/stats/base/dmax in favor of @stdlib/stats/strided/dmax.\n\nBREAKING CHANGE: remove stats/base/dmax'
190+
}, 'always' );
191+
t.deepEqual( result, [ true, '' ], 'returns expected value' );
192+
t.end();
193+
});

0 commit comments

Comments
 (0)