question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Betterer doesn't normalise line endings

See original GitHub issue

Describe the bug Beterer stores character positions in its result file which causes issues when we generate the file with CRLF source code on Windows but run betterer ci with LF source code on Linux/macOS (or vice versa).

To Reproduce

  1. Run betterer on Windows (or with CRLF files on macOS/Linux) to generate .betterer.results: yarn betterer
  2. Run betterer on macOS/Linux (or Windows with LF files) yarn betterer ci
  3. See the following error due to the change in line endings shifting char numbers by 1
Unexpected changes detected in these tests while running in CI mode

Expected behavior Beterrer normalising all files into a consistent line ending before reading them to make a results file platform/line-ending independent.

Versions (please complete the following information):

  • OS: Windows 10/macOS 11.6/Alpine Linux
  • Betterer Version 5.1.6
  • Node Version 16.14

Debug log:

betterer starting 1647208578695
▸ createGlobals args: [  {    cache: undefined,    cachePath: undefined,    ci: true,    configPaths: undefined,    cwd: '/Users/nwebster/Solutions/FrEnd/packages/frend/web/client',    excludes: undefined,    filters: undefined,    includes: [],    reporters: undefined,    resultsPath: undefined,    silent: undefined,    tsconfigPath: undefined,    workers: undefined  }]
▸▸ loadDefaultReporter args: []
▸▸▸ requireUncached args: [ '@betterer/reporter' ]
▸▸▸ requireUncached time: 46.591073989868164ms return: {  reporter: [Getter] {    configError: [Function: configError],    contextStart: [Function: contextStart],    contextEnd: [Function: contextEnd],    contextError: [Function: contextError],    suiteStart: [Function: suiteStart],    suiteEnd: [Function: suiteEnd]  }}
▸▸▸ BettererReporterΩ args: [  [    {      configError: [Function: configError],      contextStart: [Function: contextStart],      contextEnd: [Function: contextEnd],      contextError: [Function: contextError],      suiteStart: [Function: suiteStart],      suiteEnd: [Function: suiteEnd]    }  ]]
▸▸▸ BettererReporterΩ time: 8.351966142654419ms return: BettererReporterΩ {  _reporters: [    {      configError: [Function: configError],      contextStart: [Function: contextStart],      contextEnd: [Function: contextEnd],      contextError: [Function: contextError],      suiteStart: [Function: suiteStart],      suiteEnd: [Function: suiteEnd]    }  ]}
▸▸ loadDefaultReporter time: 57.87269592285156ms return: BettererReporterΩ {  _reporters: [    {      configError: [Function: configError],      contextStart: [Function: contextStart],      contextEnd: [Function: contextEnd],      contextError: [Function: contextError],      suiteStart: [Function: suiteStart],      suiteEnd: [Function: suiteEnd]    }  ]}
▸▸ createVersionControl args: []
▸▸ createVersionControl time: 4.94725489616394ms return: [Function (anonymous)]
▸▸ createConfig args: [  {    cache: undefined,    cachePath: undefined,    ci: true,    configPaths: undefined,    cwd: '/Users/nwebster/Solutions/FrEnd/packages/frend/web/client',    excludes: undefined,    filters: undefined,    includes: [],    reporters: undefined,    resultsPath: undefined,    silent: undefined,    tsconfigPath: undefined,    workers: undefined  },  [Function (anonymous)]]
▸▸▸ registerExtensions args: [ null ]
▸▸▸▸ cachedLookup args: [ [Function: createTsInternalsUncached] ]
▸▸▸▸ cachedLookup time: 2.4274418354034424ms return: [Function (anonymous)]
▸▸▸▸ SafeMap args: []
▸▸▸▸ registerExtensions time: 360.873783826828ms return: undefined
▸▸▸▸ loadSilentReporter args: []
▸▸▸▸▸ BettererReporterΩ args: [ [] ]
▸▸▸▸▸ BettererReporterΩ time: 8.578351974487305ms return: BettererReporterΩ { _reporters: [] }
▸▸▸▸ loadSilentReporter time: 10.268712043762207ms return: BettererReporterΩ { _reporters: [] }
▸▸▸▸ SafeMap.has args: [ 'init' ]
▸▸▸▸▸ SafeMap.has args: [ 'destroy' ]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
phenomnomnominalcommented, Mar 14, 2022

Thanks heaps, I’ve been seeing this and trying to debug it on our build servers too, so I’m actively working on a fix!

0reactions
jaohaohsuancommented, Mar 23, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

What does Visual Studio mean by normalize inconsistent line ...
Normalizing the line endings is just making sure that all of the line ending characters are consistent. It prevents one line from ending...
Read more >
CRLF vs. LF: Normalizing Line Endings in Git
Line endings can differ from one OS to another. Learn the history behind CRLF and LF line endings and how to enforce line...
Read more >
Normalizing line endings in Visual Studio 2019 - Super User
When I open a cs file with inconsistent line endings, Visual Studio 2019 doesn't pop up Inconsistent Line Endings dialog box anymore.
Read more >
The diff view does not handle CR line endings in files gracefully
The diff view lets git itself decide on the correct line endings to use, but the lines can themselves contain line endings of...
Read more >
Mixed and inconsistent line endings - Visual Studio Feedback
This dialog does not prevent you from committing files with mixed endings to your VCS. If this dialog showed up the moment I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found