From 3f82310175f2eae806aa3538243d8f9d42e12c6e Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Sat, 13 Jun 2026 10:06:44 +0530 Subject: [PATCH] fix: add .gitattributes to prevent CRLF corruption of test fixtures on Windows Test fixture .dat files were being corrupted by Windows CRLF line ending conversion, causing file size mismatches (1778 vs 1803 bytes). Also fixed a hardcoded Unix path separator in functionality.js test assertion. Fixes test failures on Windows for: - Disk Storage tests - Memory Storage tests - Reuse Middleware tests - Select Field tests - Functionality tests --- .gitattributes | 6 ++++++ test/functionality.js | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..a67c738e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Treat test fixture files as binary (prevent CRLF conversion on Windows) +test/files/*.dat binary +test/files/*.jpg binary \ No newline at end of file diff --git a/test/functionality.js b/test/functionality.js index a4db245a..ec351173 100644 --- a/test/functionality.js +++ b/test/functionality.js @@ -129,8 +129,8 @@ describe('Functionality', function () { util.submitForm(parser, form, function (err, req) { assert.ifError(err) assert.strictEqual(req.files.length, 2) - assert.ok(req.files[0].path.indexOf('/testforme-') >= 0) - assert.ok(req.files[1].path.indexOf('/testforme-') >= 0) + assert.ok(req.files[0].path.indexOf('testforme-') >= 0) + assert.ok(req.files[1].path.indexOf('testforme-') >= 0) done() }) })