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.

Exceeds print-width (test framework describe/it/etc. Needs docs)

See original GitHub issue

Prettier 1.14.2 Playground link

--parser babylon

Input:

describe('View', () => {
  describe('mapDispatchToProps', () => {
    it('Very long text that describes some stuff about stuff about stuff',
      () => {
        assert(
          fakeDispatch.calledWithExactly(getSomethingNiceNowAgain.request({ wazzaaa })),
        );
      });
  });
});

Output:

describe("View", () => {
  describe("mapDispatchToProps", () => {
    it("Very long text that describes some stuff about stuff about stuff", () => {
      assert(
        fakeDispatch.calledWithExactly(
          getSomethingNiceNowAgain.request({ wazzaaa })
        )
      );
    });
  });
});

Expected behavior: The arrow function should be on the line under the string.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lydellcommented, Sep 17, 2018

The print width is a guideline for Prettier, not a hard limit. Mostly, Prettier stays below it, but there are a few exceptions added by popular demand, such as testing functions and some import statements. There are also some cases where there’s nothing Prettier can do, such as string literals or comments longer than 80 chars. Or if you nest your code 50 levels deep 😃

0reactions
oskarercommented, Sep 17, 2018

Please enlighten me if I’m off, but the 80 characters limit is there for a reason. Doesn’t it destroy the purpose of the whole thing if a line > 80 characters is allowed in some exceptional cases?

I’m mostly referring to fitting several files side by side, where a loose 80 character limit would still force you to side-scroll.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unit test functions exceeding printWidth – document? #6156
Expected behavior: expected it to break across new lines to respect the 80 width rule using vscode prettier and eslint extensions (vscode ...
Read more >
Test Framework | 1.1.33 - Unity - Manual
The Unity Test Framework (UTF) enables Unity users to test their code in both Edit Mode and Play Mode, and also on target...
Read more >
C# unit test tutorial - Visual Studio (Windows) - Microsoft Learn
This article steps you through creating, running, and customizing a series of unit tests using the Microsoft unit test framework for managed ...
Read more >
Mocha - the fun, simple, flexible JavaScript test framework
simple, flexible, fun. Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun....
Read more >
Firebase A/B Testing - Google
Firebase A/B Testing helps you optimize your app experience by making it easy to run, analyze, and scale product and marketing experiments.
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