Do not break long it/test calls when template literal (#893)
* Do not break long it/test calls when template literal * expressions and newlinesmaster
parent
25bbe1accb
commit
a5ad490467
|
@ -641,6 +641,7 @@ function genericPrintNoParens(path, options, print) {
|
|||
(n.callee.name === "it" || n.callee.name === "test") &&
|
||||
n.arguments.length === 2 &&
|
||||
(n.arguments[0].type === "StringLiteral" ||
|
||||
n.arguments[0].type === "TemplateLiteral" ||
|
||||
(n.arguments[0].type === "Literal" &&
|
||||
typeof n.arguments[0].value === "string")) &&
|
||||
(n.arguments[1].type === "FunctionExpression" ||
|
||||
|
|
|
@ -11,16 +11,39 @@ it(\\"does something really long and complicated so I have to write a very long
|
|||
console.log(\\"hello!\\");
|
||||
});
|
||||
|
||||
it(\`does something really long and complicated so I have to write a very long name for the test\`, function() {
|
||||
console.log(\\"hello!\\");
|
||||
});
|
||||
|
||||
it(\`{foo + bar} does something really long and complicated so I have to write a very long name for the test\`, function() {
|
||||
console.log(\\"hello!\\");
|
||||
});
|
||||
|
||||
it(\`handles
|
||||
some
|
||||
newlines
|
||||
does something really long and complicated so I have to write a very long name for the test\`, () => {
|
||||
console.log(\\"hello!\\");
|
||||
})
|
||||
|
||||
test(\\"does something really long and complicated so I have to write a very long name for the test\\", (done) => {
|
||||
console.log(\\"hello!\\");
|
||||
});
|
||||
|
||||
test(\`does something really long and complicated so I have to write a very long name for the test\`, (done) => {
|
||||
console.log(\\"hello!\\");
|
||||
});
|
||||
|
||||
// Should break
|
||||
|
||||
it.only(\\"does something really long and complicated so I have to write a very long name for the test\\", () => {
|
||||
console.log(\\"hello!\\");
|
||||
});
|
||||
|
||||
it.only(\`does something really long and complicated so I have to write a very long name for the test\`, () => {
|
||||
console.log(\\"hello!\\");
|
||||
});
|
||||
|
||||
it.only(\\"does something really long and complicated so I have to write a very long name for the test\\", 10, () => {
|
||||
console.log(\\"hello!\\");
|
||||
});
|
||||
|
@ -43,10 +66,29 @@ it(\\"does something really long and complicated so I have to write a very long
|
|||
console.log(\\"hello!\\");
|
||||
});
|
||||
|
||||
it(\`does something really long and complicated so I have to write a very long name for the test\`, function() {
|
||||
console.log(\\"hello!\\");
|
||||
});
|
||||
|
||||
it(\`{foo + bar} does something really long and complicated so I have to write a very long name for the test\`, function() {
|
||||
console.log(\\"hello!\\");
|
||||
});
|
||||
|
||||
it(\`handles
|
||||
some
|
||||
newlines
|
||||
does something really long and complicated so I have to write a very long name for the test\`, () => {
|
||||
console.log(\\"hello!\\");
|
||||
});
|
||||
|
||||
test(\\"does something really long and complicated so I have to write a very long name for the test\\", done => {
|
||||
console.log(\\"hello!\\");
|
||||
});
|
||||
|
||||
test(\`does something really long and complicated so I have to write a very long name for the test\`, done => {
|
||||
console.log(\\"hello!\\");
|
||||
});
|
||||
|
||||
// Should break
|
||||
|
||||
it.only(
|
||||
|
@ -56,6 +98,13 @@ it.only(
|
|||
}
|
||||
);
|
||||
|
||||
it.only(
|
||||
\`does something really long and complicated so I have to write a very long name for the test\`,
|
||||
() => {
|
||||
console.log(\\"hello!\\");
|
||||
}
|
||||
);
|
||||
|
||||
it.only(
|
||||
\\"does something really long and complicated so I have to write a very long name for the test\\",
|
||||
10,
|
||||
|
|
|
@ -8,16 +8,39 @@ it("does something really long and complicated so I have to write a very long na
|
|||
console.log("hello!");
|
||||
});
|
||||
|
||||
it(`does something really long and complicated so I have to write a very long name for the test`, function() {
|
||||
console.log("hello!");
|
||||
});
|
||||
|
||||
it(`{foo + bar} does something really long and complicated so I have to write a very long name for the test`, function() {
|
||||
console.log("hello!");
|
||||
});
|
||||
|
||||
it(`handles
|
||||
some
|
||||
newlines
|
||||
does something really long and complicated so I have to write a very long name for the test`, () => {
|
||||
console.log("hello!");
|
||||
})
|
||||
|
||||
test("does something really long and complicated so I have to write a very long name for the test", (done) => {
|
||||
console.log("hello!");
|
||||
});
|
||||
|
||||
test(`does something really long and complicated so I have to write a very long name for the test`, (done) => {
|
||||
console.log("hello!");
|
||||
});
|
||||
|
||||
// Should break
|
||||
|
||||
it.only("does something really long and complicated so I have to write a very long name for the test", () => {
|
||||
console.log("hello!");
|
||||
});
|
||||
|
||||
it.only(`does something really long and complicated so I have to write a very long name for the test`, () => {
|
||||
console.log("hello!");
|
||||
});
|
||||
|
||||
it.only("does something really long and complicated so I have to write a very long name for the test", 10, () => {
|
||||
console.log("hello!");
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue