talos
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
12const { execFile, spawn } = require('child_process')13const vnu = require('vnu-jar')14
15execFile('java', ['-version'], (error, stdout, stderr) => {16if (error) {17console.error('Skipping vnu-jar test; Java is missing.')18return19}20
21const 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.25const ignores = [26// "autocomplete" is included in <button> and checkboxes and radio <input>s due to27// Firefox's non-standard autocomplete behavior - see https://bugzilla.mozilla.org/show_bug.cgi?id=65407228'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 is34// 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 example36'An “aria-disabled” attribute whose value is “true” should not be specified on an “a” element that has an “href” attribute.'37].join('|')38
39const 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`51if (is32bitJava) {52args.splice(0, 0, '-Xss512k')53}54
55return spawn('java', args, {56shell: true,57stdio: 'inherit'58})59.on('exit', process.exit)60})61