tree: 730d82562139b3662f5155f25709af727a1106f5 [path history] [tgz]
  1. .gitignore
  2. README.md
  3. layout-test-tidy.js
  4. package.json
third_party/blink/web_tests/webaudio/tools/README.md

layout-test-tidy

This tool, a Node.js CLI utility, performs a set of clean-up tasks for layout test files in web_tests/webaudio. (Potentially it can be applied to any kind of layout test files in HTML or JS format.)

The clean-up tasks includes:

  • Sanitize missing or incorrect HTML elements: reordering |script| elements or adding missing |title| element.
  • Apply html-tidy.
  • Apply clang-format.
  • Perform RegExp substitution based on predefined dictionary. (e.g. |var| to |let|, or redundant empty lines in markup.)

For every step of clean-up processing, the tool collects warning, diagnostics or notes and print out the logs at the end of the processing.

Installation

The run_web_tests.py script process all the files in the webaudio/ directory, so files created by the node package installation will pollute the test result. To avoid this, copy tools/ directory to another directory. Then run the following in that directory.

cd ${WHERE_PACKAGE_JSON_IS} npm install

The warning from html-tidy package can be safely ignored.

Usage

node layout-test-tidy [-[viR]] ${TARGET_PATH}

Available options:

  • -v or --verbose: verbose output. Useful when collecting warnings and notes generated by the tool.
  • -i or --inplace: in-place processing. Write directly into the original file.
  • -R or --recursive: Expand the given path recursively.

The result will be written to stdout, and only HTML and JS files with proper file extension (.html, .js) will be processed.

Examples

# To collect the result with warning/notes to a file.
node layout-test-tidy -v ${TARGET_PATH} > result.txt

# Apply in-place tidy to the entire layout test files for WebAudio.
node layout-test-tidy -i -R ${CHROME_SRC}/third_party/blink/web_tests/webaudio