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

fix(jest): codecov, automatic check tests to work with Jest v27 #65

Closed
mohanraj-r opened this issue Jun 15, 2021 · 4 comments
Closed

fix(jest): codecov, automatic check tests to work with Jest v27 #65

mohanraj-r opened this issue Jun 15, 2021 · 4 comments
Assignees
Labels
P2 Priority: Normal

Comments

@mohanraj-r
Copy link
Contributor

mohanraj-r commented Jun 15, 2021

Upgrading from Jest v26 to v27 results in test failures from automatic check tests that exercise the custom hook. Investigate and fix. (Found in #62)

 ● automatic checks registration › should run when called directly without setup

    Hooks cannot be defined inside tests. Hook of type "afterEach" is nested within "should run when called directly without setup".

    > 68 |         afterEach(async () => {
         |         ^
      69 |             await automaticCheck(opts);
      70 |         });
      71 |     }

      at eventHandler (node_modules/jest-circus/build/eventHandler.js:107:11)
      at registerSa11yAutomaticChecks (packages/jest/src/automatic.ts:68:9)
      at Object.<anonymous> (packages/jest/__tests__/automatic.test.ts:37:9)
@mohanraj-r mohanraj-r changed the title Fix automatic check tests to work with Jest v27 fix(jest): automatic check tests to work with Jest v27 Jun 15, 2021
@mohanraj-r mohanraj-r self-assigned this Jun 15, 2021
@mohanraj-r mohanraj-r added P1 Priority: High P2 Priority: Normal and removed P1 Priority: High labels Jun 15, 2021
mohanraj-r added a commit to mohanraj-r/sa11y that referenced this issue Jun 15, 2021
using jasmine test runner due to salesforce#65
@mohanraj-r
Copy link
Contributor Author

Workaround:

  • Use testRunner: 'jest-jasmine2' in jest config as mentioned in Jest 27: New Defaults for Jest, 2021 edition
  • Will use this workaround for now
    • but jasmine2 test runner will be removed in next major Jest release
    • hence this needs to be fixed before then

@mohanraj-r mohanraj-r changed the title fix(jest): automatic check tests to work with Jest v27 fix(jest): codecov, automatic check tests to work with Jest v27 Jun 16, 2021
@mohanraj-r
Copy link
Contributor Author

Noticing also that codecov is incorrectly reported as missing in certain areas even with testRunner: 'jest-jasmine2'. Don't see any updates to istanbul with v27 or any ref to codecov related changes in Jest 27 Milestone · GitHub. Not sure what could be causing it. Reverting back to v26 for now.

mohanraj-r added a commit to mohanraj-r/sa11y that referenced this issue Jun 23, 2021
due to automatic checks issue with circus salesforce#65
@mohanraj-r mohanraj-r changed the title fix(jest): codecov, automatic check tests to work with Jest v27 fix(jest): automatic check tests to work with Jest v27 Jun 23, 2021
@mohanraj-r mohanraj-r changed the title fix(jest): automatic check tests to work with Jest v27 fix(jest): codecov, automatic check tests to work with Jest v27 Jun 23, 2021
@mohanraj-r
Copy link
Contributor Author

mohanraj-r commented Jun 23, 2021

Also noticing that the missing codecov reports are inconsistent

  1. between the jest console reporter and the HTML lcov-report, with the console reporting more missing lines (that are actually covered by tests)
  2. between subsequent runs - After adding /* istanbul ignore next */ to reported missing lines, subsequent run errors with missing codecov in different lines that were not previously reported.

Will test again with future releases of Jest to check if this issue gets fixed.

mohanraj-r added a commit to mohanraj-r/sa11y that referenced this issue Jun 23, 2021
@jasonschroeder-sfdc
Copy link
Collaborator

#163

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

No branches or pull requests

2 participants