From 91d66be9135be49c52cd7a7a6c8ac948993541bc Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Thu, 2 Nov 2023 21:34:34 -0700 Subject: [PATCH] Grunt task improvements - Remove partial checks from `grunt standalone` and `grunt wpt` - Make `grunt unittest` only run unittests - Rename `grunt check` to `grunt typecheck` - Add `grunt checks` to run all checks` - Rename `grunt pre` to `grunt all` and make `grunt pre` an alias - Improve output of `grunt default` (aka `grunt`) - Add a little documentation for the TSDoc docs --- Gruntfile.js | 41 +++++++++++++++++++++------------------- docs/intro/developing.md | 5 +++++ package.json | 10 ++++++---- 3 files changed, 33 insertions(+), 23 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 6446a566b6ed..84ae7808b861 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -212,7 +212,9 @@ module.exports = function (grunt) { process.stderr.write('\nBuild completed! Running checks/tests'); }); - registerTaskAndAddToHelp('pre', 'Run all presubmit checks: standalone+wpt+typecheck+unittest+lint', [ + grunt.registerTask('pre', ['all']); + + registerTaskAndAddToHelp('all', 'Run all builds and checks', [ 'clean', 'generate-common', // None of the steps below have interdependencies. @@ -220,45 +222,46 @@ module.exports = function (grunt) { 'build-wpt', 'run:build-out-node', 'build-done-message', - 'ts:check', - 'run:validate', - 'run:validate-cache', - 'run:unittest', - 'run:lint', - 'run:tsdoc-treatWarningsAsErrors', + 'checks', ]); - registerTaskAndAddToHelp('standalone', 'Build standalone and typecheck', [ + registerTaskAndAddToHelp('standalone', 'Build standalone (out/) (no checks)', [ 'generate-common', 'build-standalone', 'build-done-message', - 'run:validate', - 'ts:check', ]); - registerTaskAndAddToHelp('wpt', 'Build for WPT and typecheck', [ + registerTaskAndAddToHelp('wpt', 'Build for WPT (out-wpt/) (no checks)', [ 'generate-common', 'build-wpt', 'build-done-message', - 'run:validate', + ]); + registerTaskAndAddToHelp('checks', 'Run all checks (and build tsdoc)', [ 'ts:check', + 'run:validate', + 'run:validate-cache', + 'run:unittest', + 'run:lint', + 'run:tsdoc-treatWarningsAsErrors', ]); - registerTaskAndAddToHelp('unittest', 'Build standalone, typecheck, and unittest', [ - 'standalone', + registerTaskAndAddToHelp('unittest', 'Just run unittests', [ 'run:unittest', ]); - registerTaskAndAddToHelp('check', 'Just typecheck', [ + registerTaskAndAddToHelp('typecheck', 'Just typecheck', [ 'ts:check', ]); + registerTaskAndAddToHelp('tsdoc', 'Just build tsdoc', [ + 'run:tsdoc', + ]); - registerTaskAndAddToHelp('serve', 'Serve out/ on 127.0.0.1:8080 (does NOT compile source)', ['run:serve']); + registerTaskAndAddToHelp('serve', 'Serve out/ (without building anything)', ['run:serve']); registerTaskAndAddToHelp('fix', 'Fix lint and formatting', ['run:fix']); addExistingTaskToHelp('clean', 'Delete built and generated files'); grunt.registerTask('default', '', () => { - console.error('\nAvailable tasks (see grunt --help for info):'); + console.error('\nRecommended tasks:'); + let nameColumnSize = Math.max(...helpMessageTasks.map(({ name }) => name.length)); for (const { name, desc } of helpMessageTasks) { - console.error(`$ grunt ${name}`); - console.error(` ${desc}`); + console.error(`$ grunt ${name.padEnd(nameColumnSize)} # ${desc}`); } }); }; diff --git a/docs/intro/developing.md b/docs/intro/developing.md index 5b1aeed36d7a..a942a6842d75 100644 --- a/docs/intro/developing.md +++ b/docs/intro/developing.md @@ -34,6 +34,11 @@ the standalone runner.) Note: The first load of a test suite may take some time as generating the test suite listing can take a few seconds. +## Documentation + +In addition to the documentation pages you're reading, there is TSDoc documentation. +Start at the [helper index](https://gpuweb.github.io/cts/docs/tsdoc/). + ## Standalone Test Runner / Test Plan Viewer **The standalone test runner also serves as a test plan viewer.** diff --git a/package.json b/package.json index 21f74065af18..c9d82e3ba9e2 100644 --- a/package.json +++ b/package.json @@ -3,15 +3,17 @@ "version": "0.1.0", "description": "WebGPU Conformance Test Suite", "scripts": { - "test": "grunt pre", - "check": "grunt check", + "test": "grunt all", + "all": "grunt all", "standalone": "grunt standalone", "wpt": "grunt wpt", - "fix": "grunt fix", + "checks": "grunt checks", "unittest": "grunt unittest", + "typecheck": "grunt typecheck", + "fix": "grunt fix", "gen_wpt_cts_html": "node tools/gen_wpt_cts_html", "gen_cache": "node tools/gen_cache", - "tsdoc": "grunt run:tsdoc", + "tsdoc": "grunt tsdoc", "start": "node tools/dev_server", "dev": "node tools/dev_server" },