fulldecent / github-pages-template

An opinionated starting point and build system for awesome, collaboratively-edited HTML websites
https://fulldecent.github.io/github-pages-template/
34 stars 50 forks source link

github-pages-template fixture for testing no jquery added. #54

Closed Raza403 closed 10 months ago

Raza403 commented 10 months ago

A test for no-jquery was added. Test will pass if /test/fixtures/no-jquery.html has a jquery script tag, otherwise the test will fail. This PR is made for #50

Raza403 commented 10 months ago

@fulldecent please check, now we have one file doing both tests. The reason for having

 const actualMessages = report.results.length === 0
    ? []
    : report.results[0].messages;

  const hasExpectedMessage = actualMessages.some(
    (actualMessage) =>
      actualMessage.ruleId === messages[0].ruleId &&
      actualMessage.message === messages[0].message
  );

is because there are some extra properties in actual.

Expected:
[
  {
    "ruleId": "pacific-medical-training/no-jquery",
    "severity": 2,
    "message": "script tag with src including jQuery",
    "size": 0,
    "selector": null,
    "ruleUrl": "https://github.com/fulldecent/github-pages-template/"
  }
]

Actual:
[
  {
    "ruleId": "pacific-medical-training/no-jquery",
    "severity": 2,
    "message": "script tag with src including jQuery",
    "offset": 242,
    "line": 8,
    "column": 6,
    "size": 6,
    "selector": "html > head > script"
  }
]

I would request your review again please.

fulldecent commented 10 months ago

@Raza403 Please check out main branch. Everything is implemented with the new .mjs (ESM) format for the new html-validate.