microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.4k stars 12.41k forks source link

gulp builds give misleading errors on unsuccessful tasks #30027

Closed DanielRosenwasser closed 5 years ago

DanielRosenwasser commented 5 years ago

I tried running gulp runtests-parallel.

src/testRunner/parallel/host.ts:10:51 - error TS7016: Could not find a declaration file for module 'ms'. '/home/daniel/shared/TypeScript3/node_modules/ms/index.js' implicitly has an 'any' type.
  Try `npm install @types/ms` if it exists or add a new declaration (.d.ts) file containing `declare module 'ms';`

10         const ms = require("ms") as typeof import("ms");
                                                     ~~~~

yarn

Found 1 error.

[10:54:08] 'buildRules' errored after 1.1 min
[10:54:08] Error: Process exited with code: 1
    at ChildProcess.proc.on.exitCode (/home/daniel/shared/TypeScript3/scripts/build/utils.js:52:24)
    at ChildProcess.emit (events.js:182:13)
    at ChildProcess.EventEmitter.emit (domain.js:460:23)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
[10:54:08] 'runtests-parallel' errored after 1.12 min
[10:54:08] The following tasks did not complete: buildTests, <series>, <series>, buildTypescriptServicesOut, buildServerLibraryOut
[10:54:08] Did you forget to signal async completion?

Is it possible that the build file forgot to signal async completion?

DanielRosenwasser commented 5 years ago

This also seems to happen if baselines fail.

sheetalkamat commented 5 years ago

Also noticed some error message indicating gulp baseline-accept has failed but it had updated baselines

c:\TypeScript>gulp baseline-accept
[12:38:40] Using gulpfile c:\TypeScript\gulpfile.js
[12:38:40] Starting 'baseline-accept'...
[12:38:40] The following tasks did not complete: baseline-accept
[12:38:40] Did you forget to signal async completion?
weswigham commented 5 years ago

AFAIK it's because we use process.exit instead of a throw on test failure. I think now that we don't rely on streams much, it should be able to just throw and we can set process.exitCode with the desired code.

weswigham commented 5 years ago

So fixing the runtests bit is easy, but it looks like the baseline-accept one's a bit different. @rbuckton it looks like the

src([`${localBaseline}${subfolder ? `${subfolder}/` : ``}**/*.delete`], { base: localBaseline, read: false })

stream never calls .end() for some reason. Is it perhaps because the rm filter never signals completion?

weswigham commented 5 years ago

Righto, so I put up a fix for the no-completion warnings, but @DanielRosenwasser your issue with ms is simply that you need to run npm install (if you care)