Skip to content

Commit

Permalink
Grunt task improvements
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
kainino0x committed Nov 4, 2023
1 parent 09947b9 commit 91d66be
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 23 deletions.
41 changes: 22 additions & 19 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,53 +212,56 @@ 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.
'build-standalone',
'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}`);
}
});
};
5 changes: 5 additions & 0 deletions docs/intro/developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.**
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down

0 comments on commit 91d66be

Please sign in to comment.