Skip to content

Commit 8933c84

Browse files
committed
fix(linter): Fix jest/expect-expect rule docs. (#16550)
Fixes #16491. The default value here is a bit weird so I had to adjust the docs to make it clear that there's a distinction with jest vs vitest. Generated docs: ```md ## Configuration This rule accepts a configuration object with the following properties: ### additionalTestBlockFunctions type: `string[]` default: `[]` An array of function names that should also be treated as test blocks. ### assertFunctionNames type: `string[]` default: `["expect"]` A list of function names that should be treated as assertion functions. NOTE: The default value is `["expect"]` for Jest and `["expect", "expectTypeOf", "assert", "assertType"]` for Vitest. ```
1 parent 82261df commit 8933c84

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

crates/oxc_linter/src/rules/jest/expect_expect.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ pub struct ExpectExpect(Box<ExpectExpectConfig>);
3535
#[serde(rename_all = "camelCase", default)]
3636
pub struct ExpectExpectConfig {
3737
/// A list of function names that should be treated as assertion functions.
38+
///
39+
/// NOTE: The default value is `["expect"]` for Jest and
40+
/// `["expect", "expectTypeOf", "assert", "assertType"]` for Vitest.
41+
#[serde(rename = "assertFunctionNames")]
3842
assert_function_names_jest: Vec<CompactStr>,
39-
/// A list of function names that should be treated as assertion functions for Vitest.
43+
#[schemars(skip)] // Skipped because this field isn't exposed to the user.
4044
assert_function_names_vitest: Vec<CompactStr>,
4145
/// An array of function names that should also be treated as test blocks.
4246
additional_test_block_functions: Vec<CompactStr>,

0 commit comments

Comments
 (0)