tree: 0e61b716d306edde21b1be9e4603838421958cad [path history] [tgz]
  1. .gitignore
  3. layout-test-tidy.js
  4. package.json


This tool, a Node.js CLI utility, performs a set of clean-up tasks for layout test files in LayoutTests/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.


The run-webkit-tests 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.


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.


# 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/WebKit/LayoutTests/webaudio