Skip to content

#3475874: Enforce ESLint and Prettier on Cypress tests

Closes #3475874

  • Added eslint-plugin-cypress and eslint-plugin-chai-friendly to the eslint config under overrides so it is only
    applied to the UI test directory. The chai plugin is used to allow the use of 'expect' in the UI tests without
    triggering an eslint error. I added a comment in the config that explains this.
  • Renamed the npm command from format to prettier:fix and I also added a prettier:check command.
  • Added mention of eslint-plugin-cypress to the testing section of the README.

Test files that contains manual changes unrelated to prettier fixes:

  • prop-types.cy.js (changed to adhere to unsafe-to-chain-command)
  • undo-redo.cy.js (unsafe-to-chain-command)
  • xb-canvas.cy.js (unsafe-to-chain-command)
  • commands.js (no-restricted-globals)
  • e2e.js (no-extend-native does not like extending the native String object so I replaced it with a utils function onlyVisibleChars in newly created utils.js)
  • add-section.cy.js (updated to use new onlyVisibleChars function)
  • xb-general.cy.js (updated to use new onlyVisibleChars function, unsafe-to-chain-command fixes and updated a selector that looked like a copy and paste error from a previous MR- left a comment)
  • configuration-slice.cy.js (changed to use file path alias for import statements)
  • layout-slice.cy.js (changed to use file path alias for import statements)
  • layout-utils.cy.js (changed to use file path alias for import statements)
  • ui-slice.cy.js (changed to use file path alias for import statements)
Edited by Harumi Jang

Merge request reports

Loading