Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: "Could not read results" on large result file? #371

Closed
Svish opened this issue Nov 2, 2020 · 6 comments · Fixed by #372
Closed

BUG: "Could not read results" on large result file? #371

Svish opened this issue Nov 2, 2020 · 6 comments · Fixed by #372

Comments

@Svish
Copy link

Svish commented Nov 2, 2020

I have the following .betterer.ts:

import { typescript } from '@betterer/typescript';
import { eslint } from '@betterer/eslint';

export default {
  'stricter typescript': typescript('./tsconfig.json', {
    strict: true,
  }),

  'stricter eslint': eslint({
    '@typescript-eslint/ban-ts-comment': 'error',
    '@typescript-eslint/ban-types': 'error',
    '@typescript-eslint/explicit-function-return-type': 'error',
    '@typescript-eslint/explicit-module-boundary-types': 'error',
    '@typescript-eslint/no-empty-function': 'error',
    '@typescript-eslint/no-explicit-any': 'error',
    '@typescript-eslint/no-floating-promises': 'error',
    '@typescript-eslint/no-inferrable-types': 'error',
    '@typescript-eslint/no-redeclare': 'error',
    '@typescript-eslint/no-unnecessary-type-assertion': 'error',
    '@typescript-eslint/no-unsafe-assignment': 'error',
    '@typescript-eslint/no-unsafe-call': 'error',
    '@typescript-eslint/no-unsafe-member-access': 'error',
    '@typescript-eslint/no-unsafe-return': 'error',
    '@typescript-eslint/no-unused-vars': 'error',
    '@typescript-eslint/no-var-requires': 'error',
    '@typescript-eslint/prefer-optional-chain': 'error',
    '@typescript-eslint/restrict-plus-operands': 'error',
    '@typescript-eslint/restrict-template-expressions': 'error',
    '@typescript-eslint/strict-boolean-expressions': 'error',
    '@typescript-eslint/switch-exhaustiveness-check': 'error',
    '@typescript-eslint/unbound-method': 'error',
    'import/no-anonymous-default-export': 'error',
    'jsx-a11y/alt-text': 'error',
    'jsx-a11y/anchor-is-valid': 'error',
    'jsx-a11y/click-events-have-key-events': 'error',
    'jsx-a11y/label-has-associated-control': 'error',
    'jsx-a11y/no-autofocus': 'error',
    'jsx-a11y/no-noninteractive-element-interactions': 'error',
    'jsx-a11y/no-onchange': 'error',
    'jsx-a11y/no-static-element-interactions': 'error',
    'no-use-before-define': 'error',
    'react-hooks/exhaustive-deps': 'error',
    'react/jsx-no-target-blank': 'error',
    'react/prop-types': 'error',
  })
    .include('./Content/Scripts/**/*.{ts,tsx,js,jsx}'),
};

Running npx betterer the first time works fine, and the .betterer.results is generated. However, when I try to run it again, I get the following error:

   \ | /     _          _   _                     
 '-.ooo.-'  | |__   ___| |_| |_ ___ _ __ ___ _ __ 
---ooooo--- | '_ \ / _ \ __| __/ _ \ '__/ _ \ '__|
 .-'ooo'-.  | |_) |  __/ |_| ||  __/ | |  __/ |   
   / | \    |_.__/ \___|\__|\__\___|_|  \___|_|   
 
 ☀️  betterer  erro  🔥  -  could not read results from "C:\dev\projects\portal\OPF.Portal.Web\.betterer.results". 😔
  • If I delete .betterer.results, and .skip() the stricter eslint test, then it runs fine both times.
  • If I delete .betterer.results, and .skip() the stricter typescript test, then I get the same error.

In other words, the stricter eslint test caused the second run to fail, regardless of the stricter typescript being part of it or not.


Adding @betterer/eslint did make the .betterer.results file grow from ~2k lines to ~15k lines. So from from what I can gather, this must probably have something to do with how you're trying to read that file? Is it running into some sort of size/buffer issue or something? Not sure why the file size should be an issue, but the way that file is read here does seem a bit... special... 🤔

I guess it could also be related to the format of the output from @betterer/eslint vs @betterer/typescript, but as far as I can see, those look pretty much identical, so... 🤷‍♂️

@Svish Svish changed the title BUG: "Could not read results" BUG: "Could not read results" on large result file? Nov 2, 2020
@Svish
Copy link
Author

Svish commented Nov 2, 2020

Added a console.error where the exception is caught and "replaced" with the COULDNT_READ_RESULTS message:

ReferenceError: key is not defined
    at Object.<anonymous> (0:13559:48)
    at Module._compile (internal/modules/cjs/loader.js:1076:30)
    at Object.requireText (C:\dev\projects\portal\OPF.Portal.Web\node_modules\@betterer\betterer\src\require.ts:22:37)
    at Object.<anonymous> (C:\dev\projects\portal\OPF.Portal.Web\node_modules\@betterer\betterer\src\results\reader.ts:31:12)
    at step (C:\dev\projects\portal\OPF.Portal.Web\node_modules\@betterer\betterer\node_modules\tslib\tslib.js:140:27)
    at Object.next (C:\dev\projects\portal\OPF.Portal.Web\node_modules\@betterer\betterer\node_modules\tslib\tslib.js:121:57)
    at fulfilled (C:\dev\projects\portal\OPF.Portal.Web\node_modules\@betterer\betterer\node_modules\tslib\tslib.js:111:62)

If that makes any sense to you... 🤔

@Svish
Copy link
Author

Svish commented Nov 2, 2020

Here's the result-file causing the crash:

(Only available via my OneDrive for 2 weeks, so grab it while you can 🙂)

@phenomnomnominal
Copy link
Owner

Looks like you've found a pathological case for my file printing! I don't just read the file as text, but I actually require it, so this issue here causes everything to break:

[250, 43, 25, "Unsafe member access [\`${key}Changed\`] on an any value.", "1548669727"]

Should be an easy fix, I'll have a crack now.

@phenomnomnominal
Copy link
Owner

Should be fixed in 3.1.2!

@Svish
Copy link
Author

Svish commented Nov 3, 2020

Awesome! Will test it at work tomorrow 👍

@Svish
Copy link
Author

Svish commented Nov 3, 2020

✅ Seems to work now, thanks 😊👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants