function loadPatterns(additionalValid, additionalInvalid) {
  const valid = fs.readdirSync(FIXTURE_ROOT).map((filename) => {
    const code0 = fs.readFileSync(path.join(FIXTURE_ROOT, filename), 'utf8')
    const code = code0.replace(/^<!--(.+?)-->/, `<!--${filename}-->`)
    const baseObj = JSON.parse(/^<!--(.+?)-->/.exec(code0)[1])
    if ('parser' in baseObj) {
      baseObj.parser = require.resolve(baseObj.parser)
    }
    if ('parserOptions' in baseObj && 'parser' in baseObj.parserOptions) {
      baseObj.parserOptions.parser = require.resolve(
        baseObj.parserOptions.parser
      )
    }
    return Object.assign(baseObj, { code, filename })
  })
  const invalid = valid
    .map((pattern) => {
      const kind =
        (pattern.options && pattern.options[0]) === 'tab' ? 'tab' : 'space'
      const output = pattern.code
      const lines = output.split('\n').map((text, number) => ({
        number,
        text,
        indentSize: (/^[\t ]+/.exec(text) || [''])[0].length
      }))
      const code = lines
        .map((line) => line.text.replace(/^[\t ]+/, ''))
        .join('\n')
      const errors = lines
        .map((line) =>
          line.indentSize === 0
            ? null
            : {
                message: `Expected indentation of ${line.indentSize} ${kind}${
                  line.indentSize === 1 ? '' : 's'
                } but found 0 ${kind}s.`,
                line: line.number + 1
              }
        )
        .filter(Boolean)

      return Object.assign({}, pattern, { code, output, errors })
    })
    .filter((invalid) => invalid.errors.length > 0) // Empty errors cannot be verified with eslint 7.3.
    .filter(Boolean)

  return {
    valid: [...valid, ...additionalValid],
    invalid: [...invalid, ...additionalInvalid]
  }
}
Load test patterns from fixtures.

- Valid tests:   All codes in FIXTURE_ROOT are valid code.
- Invalid tests: There is an invalid test for every valid test. It removes
                 all indentations from the valid test and checks whether
                 `html-indent` rule restores the removed indentations exactly.

If a test has some ignored line, we can't use the mechanism.
So `additionalValid` and `additionalInvalid` exist for asymmetry test cases.

@param {object[]} additionalValid The array of additional valid patterns.
@param {object[]} additionalInvalid The array of additional invalid patterns.
@returns {object} The loaded patterns.