Revision 80776951675e2d55bae5159756ce793888ad986a authored by George Kalpakas on 26 November 2021, 17:46:30 UTC, committed by Dylan Hunn on 29 November 2021, 17:38:06 UTC
Previously, the mock packages created for `UmdDependencyHost`'s tests,
specified the entry-point as `esm2015`. This does not matter in tests,
since the packages are explicitly passed to the `UmdDependencyHost`
(while in reality the appropriate host would be determined based on the
name of the entry-point property - in this case, detecting the
entry-point as ES2015 and not UMD).

However, in order to avoid confusion, this commit updates the test
packages to use `main` (the default property used for the UMD format in
`package.json` files).

PR Close #44245
1 parent de0975c
Raw File
test-aio-a11y.mjs
#!/bin/env node

/**
 * Usage:
 * ```sh
 * node scripts/test-aio-a11y.mjs <origin>
 * ```
 *
 * Runs accessibility audits on several (pre-defined) pages on the specified origin. It fails, if
 * the score for any page is below the minimum (see `MIN_SCORES_PER_PAGE` below).
 *
 * `<origin>` is the origin (scheme + hostname + port) of an angular.io deployment. It can be remote
 * (e.g. `https://next.angular.io`) or local (e.g. `http://localhost:4200`).
 */

// Imports
import {dirname} from 'path';
import sh from 'shelljs';
import {fileURLToPath} from 'url';

sh.set('-e');

// Constants
const MIN_SCORES_PER_PAGE = {
  '': 100,
  'api': 100,
  'api/core/Directive': 98,
  'cli': 100,
  'cli/add': 100,
  'docs': 100,
  'guide/docs-style-guide': 96,
  'start/start-routing': 98,
  'tutorial': 98,
};

// Run
const __dirname = dirname(fileURLToPath(import.meta.url));
const auditWebAppCmd = `"${process.execPath}" "${__dirname}/audit-web-app.mjs"`;
const origin = process.argv[2];
for (const [page, minScore] of Object.entries(MIN_SCORES_PER_PAGE)) {
  sh.exec(`${auditWebAppCmd} ${origin}/${page} accessibility:${minScore}`);
}
back to top