diff --git a/src/language-js/printer-estree.js b/src/language-js/printer-estree.js index e24896a877a8..cc1aa005a31c 100644 --- a/src/language-js/printer-estree.js +++ b/src/language-js/printer-estree.js @@ -5814,7 +5814,9 @@ function isAngularTestWrapper(node) { (node.type === "CallExpression" || node.type === "OptionalCallExpression") && node.callee.type === "Identifier" && - (node.callee.name === "async" || node.callee.name === "inject") + (node.callee.name === "async" || + node.callee.name === "inject" || + node.callee.name === "fakeAsync") ); } diff --git a/tests/test_declarations/__snapshots__/jsfmt.spec.js.snap b/tests/test_declarations/__snapshots__/jsfmt.spec.js.snap index 5ba0c216ef27..e999df88560c 100644 --- a/tests/test_declarations/__snapshots__/jsfmt.spec.js.snap +++ b/tests/test_declarations/__snapshots__/jsfmt.spec.js.snap @@ -102,6 +102,108 @@ function x() { `; +exports[`angular_fakeAsync.js - flow-verify 1`] = ` +beforeEach(fakeAsync(() => { + // code +})); + +afterAll(fakeAsync(() => { + console.log('Hello'); +})); + +it('should create the app', fakeAsync(() => { + //code +})); + +it("does something really long and complicated so I have to write a very long name for the test", fakeAsync(() => { + // code +})); + +/* +* isTestCall(parent) should only be called when parent exists +* and parent.type is CallExpression. This test makes sure that +* no errors are thrown when calling isTestCall(parent) +*/ +function x() { fakeAsync(() => {}) } +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +beforeEach(fakeAsync(() => { + // code +})); + +afterAll(fakeAsync(() => { + console.log("Hello"); +})); + +it("should create the app", fakeAsync(() => { + //code +})); + +it("does something really long and complicated so I have to write a very long name for the test", fakeAsync(() => { + // code +})); + +/* +* isTestCall(parent) should only be called when parent exists +* and parent.type is CallExpression. This test makes sure that +* no errors are thrown when calling isTestCall(parent) +*/ +function x() { + fakeAsync(() => {}); +} + +`; + +exports[`angular_fakeAsync.js - flow-verify 2`] = ` +beforeEach(fakeAsync(() => { + // code +})); + +afterAll(fakeAsync(() => { + console.log('Hello'); +})); + +it('should create the app', fakeAsync(() => { + //code +})); + +it("does something really long and complicated so I have to write a very long name for the test", fakeAsync(() => { + // code +})); + +/* +* isTestCall(parent) should only be called when parent exists +* and parent.type is CallExpression. This test makes sure that +* no errors are thrown when calling isTestCall(parent) +*/ +function x() { fakeAsync(() => {}) } +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +beforeEach(fakeAsync(() => { + // code +})); + +afterAll(fakeAsync(() => { + console.log("Hello"); +})); + +it("should create the app", fakeAsync(() => { + //code +})); + +it("does something really long and complicated so I have to write a very long name for the test", fakeAsync(() => { + // code +})); + +/* +* isTestCall(parent) should only be called when parent exists +* and parent.type is CallExpression. This test makes sure that +* no errors are thrown when calling isTestCall(parent) +*/ +function x() { + fakeAsync(() => {}); +} + +`; + exports[`angularjs_inject.js - flow-verify 1`] = ` beforeEach(inject(($fooService, $barService) => { // code diff --git a/tests/test_declarations/angular_fakeAsync.js b/tests/test_declarations/angular_fakeAsync.js new file mode 100644 index 000000000000..d4f4f01e5543 --- /dev/null +++ b/tests/test_declarations/angular_fakeAsync.js @@ -0,0 +1,22 @@ +beforeEach(fakeAsync(() => { + // code +})); + +afterAll(fakeAsync(() => { + console.log('Hello'); +})); + +it('should create the app', fakeAsync(() => { + //code +})); + +it("does something really long and complicated so I have to write a very long name for the test", fakeAsync(() => { + // code +})); + +/* +* isTestCall(parent) should only be called when parent exists +* and parent.type is CallExpression. This test makes sure that +* no errors are thrown when calling isTestCall(parent) +*/ +function x() { fakeAsync(() => {}) }