talos

Форк
0
60 строк · 2.1 Кб
1
#!/usr/bin/env node
2

3
/*!
4
 * Script to run vnu-jar if Java is available.
5
 * Copyright 2017-2021 The Bootstrap Authors
6
 * Copyright 2017-2021 Twitter, Inc.
7
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
8
 */
9

10
'use strict'
11

12
const { execFile, spawn } = require('child_process')
13
const vnu = require('vnu-jar')
14

15
execFile('java', ['-version'], (error, stdout, stderr) => {
16
  if (error) {
17
    console.error('Skipping vnu-jar test; Java is missing.')
18
    return
19
  }
20

21
  const is32bitJava = !/64-Bit/.test(stderr)
22

23
  // vnu-jar accepts multiple ignores joined with a `|`.
24
  // Also note that the ignores are string regular expressions.
25
  const ignores = [
26
    // "autocomplete" is included in <button> and checkboxes and radio <input>s due to
27
    // Firefox's non-standard autocomplete behavior - see https://bugzilla.mozilla.org/show_bug.cgi?id=654072
28
    'Attribute “autocomplete” is only allowed when the input type is.*',
29
    'Attribute “autocomplete” not allowed on element “button” at this point.',
30
    // IE11 doesn't recognise <main> / give the element an implicit "main" landmark.
31
    // Explicit role="main" is redundant for other modern browsers, but still valid.
32
    'The “main” role is unnecessary for element “main”.',
33
    // Per https://www.w3.org/TR/html-aria/#docconformance having "aria-disabled" on a link is
34
    // NOT RECOMMENDED, but it's still valid - we explain in the docs that it's not ideal,
35
    // and offer more robust alternatives, but also need to show a less-than-ideal example
36
    'An “aria-disabled” attribute whose value is “true” should not be specified on an “a” element that has an “href” attribute.'
37
  ].join('|')
38

39
  const args = [
40
    '-jar',
41
    `"${vnu}"`,
42
    '--asciiquotes',
43
    '--skip-non-html',
44
    '--Werror',
45
    `--filterpattern "${ignores}"`,
46
    '_site/',
47
    'js/tests/'
48
  ]
49

50
  // For the 32-bit Java we need to pass `-Xss512k`
51
  if (is32bitJava) {
52
    args.splice(0, 0, '-Xss512k')
53
  }
54

55
  return spawn('java', args, {
56
    shell: true,
57
    stdio: 'inherit'
58
  })
59
    .on('exit', process.exit)
60
})
61

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.