Misc cleanup of test runner and .d.ts files

New version of PR #2224