From 06d3f027dd68b56633591f7b83c32c0fc39a49e0 Mon Sep 17 00:00:00 2001 From: Strycher Date: Mon, 20 Jul 2026 17:54:37 -0400 Subject: [PATCH] test(#335): make the drift asset-version guard line-ending agnostic The guard read pubspec.lock with a newline-sensitive regex, so it passed on LF (CI) and failed on CRLF (Windows) for the same, correct assets. A guard that is itself platform-fragile is worse than none. Normalise CRLF->LF before matching. Surfaced by the 290+306+335 integration merge, where the lockfile came through with CRLF endings. --- test/storage/drift_asset_version_test.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/storage/drift_asset_version_test.dart b/test/storage/drift_asset_version_test.dart index c8760db..e917fe1 100644 --- a/test/storage/drift_asset_version_test.dart +++ b/test/storage/drift_asset_version_test.dart @@ -24,10 +24,14 @@ void main() { 'reproducible; the drift web assets are matched against it.', ); + // Normalise line endings first: pubspec.lock is CRLF on Windows and LF in + // CI, and a newline-sensitive pattern would pass on one and fail on the + // other. A guard that is itself platform-fragile is worse than none. + final lockText = lock.readAsStringSync().replaceAll('\r\n', '\n'); final resolved = RegExp( r'^ drift:\n(?:.*\n)*? version: "([^"]+)"', multiLine: true, - ).firstMatch(lock.readAsStringSync())?.group(1); + ).firstMatch(lockText)?.group(1); expect(resolved, isNotNull, reason: 'drift not found in pubspec.lock'); final stamp = File('$root/web/drift_assets.version');