Skip to content
This repository has been archived by the owner on Aug 28, 2022. It is now read-only.

Error from prettier, when test start #185

Open
IvanSavoskin opened this issue May 21, 2021 · 4 comments
Open

Error from prettier, when test start #185

IvanSavoskin opened this issue May 21, 2021 · 4 comments
Labels
bug Something isn't working
Milestone

Comments

@IvanSavoskin
Copy link

Describe the bug

When starting the test, the following error occurs

Test suite failed to run

    SyntaxError: Identifier expected. (1:10)
    > 1 | function () {
        |          ^
      2 |       return _ref4.apply(this, arguments);
      3 |     }

      at e (node_modules/prettier/parser-typescript.js:1:322)
      at node_modules/prettier/parser-typescript.js:1:3179371
      at Object.parse (node_modules/prettier/parser-typescript.js:1:3179404)
      at Object.parse (node_modules/prettier/standalone.js:15:105894)
      at jp (node_modules/prettier/standalone.js:15:129009)
      at Vp (node_modules/prettier/standalone.js:15:131628)
      at node_modules/prettier/standalone.js:55:38189
      at Object.format (node_modules/prettier/standalone.js:55:38272)
      at AllureReporter.extractCodeDetails (node_modules/jest-circus-allure-environment/src/allure-reporter.ts:320:19)
      at AllureReporter.startTestCase (node_modules/jest-circus-allure-environment/src/allure-reporter.ts:166:43)

To Reproduce

Code test

it("Editor helper test", async () => {
     await editorHelpersTest(mockFunctionsList);
 });

This is test ts file

@IvanSavoskin IvanSavoskin added the bug Something isn't working label May 21, 2021
@ryparker
Copy link
Owner

Hey @IvanSavoskin 👋

Thanks for opening this bug. I'm not able to reproduce what you have reported above. Have you tried testing on a dummy test? Something simple like:

test('Expect to pass', () => {
	expect(1 + 2).toBe(3);
});

This would help us narrow down the issue. Any additional implementation details such as package version, jest config setup, and tests would be helpful too. 😄

@ryparker ryparker added the response-requested Waiting on author's response label Jun 21, 2021
@rodush
Copy link

rodush commented Jun 22, 2021

@ryparker I am facing the exactly same problem, reported from many unexpected places.
Environment:

  • node 14.16.1
  • npm 7.14.0
  • jest 27.0.4
  • "jest-circus-allure-environment": "^1.1.1"
  • "ts-node": "^9.1.1"
  • "ts-jest": "^27.0.3",

E.g.:

SyntaxError: ',' expected. (6:7)
      4 |                 paymentMethod: {
      5 |                     // @ts-
    > 6 | expect-error: fake payment method name
        |       ^
      7 |                     getName() {
      8 |                         return "ExternalPaymentMethod";
      9 |                     },

      at e (node_modules/prettier/parser-typescript.js:1:322)
      at node_modules/prettier/parser-typescript.js:1:3179371
      at Object.parse (node_modules/prettier/parser-typescript.js:1:3179404)
      at Object.parse (node_modules/prettier/standalone.js:15:105894)
      at jp (node_modules/prettier/standalone.js:15:129009)
      at Vp (node_modules/prettier/standalone.js:15:131628)
      at node_modules/prettier/standalone.js:55:38189
      at Object.format (node_modules/prettier/standalone.js:55:38272)
      at AllureReporter.extractCodeDetails (node_modules/jest-circus-allure-environment/src/allure-reporter.ts:320:19)
      at AllureReporter.startTestCase (node_modules/jest-circus-allure-environment/src/allure-reporter.ts:166:43)

UPDATE:
This is only thrown if testEnvironment is set to "jest-circus-allure-environment"; when it's "node", then tests run okay.

@rodush
Copy link

rodush commented Jun 22, 2021

I guess, the issue around @ts-expect-error is the regex here - https://github.com/ryparker/jest-circus-allure-environment/blob/main/src/allure-reporter.ts#L319 , where it should actually check for word boundary with a \b, for instance

@ryparker ryparker removed the response-requested Waiting on author's response label Jun 22, 2021
@Naimadnap
Copy link

@ryparker any ETA to fix it or @rodush/ @IvanSavoskin maybe you have some workaround

@ryparker ryparker added this to the V2.0 milestone Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants