@@ -146,6 +146,46 @@ describe("format-docs", () => {
146146 expect ( oxfmtFileArgs [ 1 ] ?. every ( ( filePath ) => filePath . startsWith ( root ) ) ) . toBe ( false ) ;
147147 } ) ;
148148
149+ it ( "normalizes CRLF to LF before comparing in check mode" , ( ) => {
150+ const root = createTempDir ( "openclaw-format-docs-crlf-" ) ;
151+ fs . mkdirSync ( path . join ( root , "docs" ) , { recursive : true } ) ;
152+
153+ fs . writeFileSync ( path . join ( root , "docs" , "crlf.md" ) , "# Heading\r\n\r\nText\r\n" , "utf8" ) ;
154+
155+ const spawnSync = ( command : string , args : string [ ] ) => {
156+ if ( command === "git" ) {
157+ return {
158+ status : 0 ,
159+ stderr : "" ,
160+ stdout : "docs/crlf.md\n" ,
161+ } ;
162+ }
163+
164+ const filePaths = args . filter ( ( arg ) => arg . endsWith ( ".md" ) ) ;
165+ for ( const filePath of filePaths ) {
166+ if ( fs . existsSync ( filePath ) ) {
167+ fs . writeFileSync ( filePath , "# Heading\n\nText\n" , "utf8" ) ;
168+ }
169+ }
170+
171+ return { status : 0 , stderr : "" , stdout : "" } ;
172+ } ;
173+
174+ const result = formatDocs (
175+ {
176+ check : true ,
177+ repoRoot : root ,
178+ root,
179+ } ,
180+ {
181+ existsSync : fs . existsSync ,
182+ spawnSync,
183+ } ,
184+ ) ;
185+
186+ expect ( result ) . toEqual ( { changed : [ ] , fileCount : 1 } ) ;
187+ } ) ;
188+
149189 it ( "keeps single oversized docs in their own command chunk" , ( ) => {
150190 expect ( chunkFilesForCommand ( [ "docs/very-long-name.md" ] , [ "--write" ] , 1 ) ) . toEqual ( [
151191 [ "docs/very-long-name.md" ] ,
0 commit comments