palantir / blueprint

A React-based UI toolkit for the web
https://blueprintjs.com/
Apache License 2.0
20.67k stars 2.17k forks source link

Test compilation errors do not fail karma tasks #780

Closed adidahiya closed 6 years ago

adidahiya commented 7 years ago

Discovered in https://github.com/palantir/blueprint/pull/775#issuecomment-284160519

Current compilation failures are fixed in https://github.com/palantir/blueprint/pull/779, but we need to fix the build system to fail on tsc errors. I tried to get this working using solutions from https://github.com/TypeStrong/ts-loader/issues/108 but did not succeed. A quick and dirty fix would be to run tsc -p packages/<name>/test commands in the verify script or in gulp check. Or we could try upgrading to webpack 2 (shouldn't be too hard; I just did it on another project).

adidahiya commented 7 years ago

Same goes for tsc errors in examples via npm run build:gulp

ERROR in ./packages/table/examples/tableFormatsExample.tsx
(13,10): error TS6133: 'TruncatedPopoverMode' is declared but never used.
giladgray commented 7 years ago

i'm down for webpack 2 upgrade. i actually did that locally last week as part of the unpkg work but then realized webpack 1 supported what i was trying to do.

giladgray commented 7 years ago

I can't seem to upgrade to webpack2. Getting this error from ts-loader:

[12:40:26] Starting 'webpack-docs'...
(node:69788) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'default' of undefined
(node:69788) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[12:40:26] [webpack] Time: 83ms
      Asset     Size  Chunks             Chunk Names
    docs.js     3 kB       0  [emitted]  docs
docs.js.map  2.61 kB       0  [emitted]  docs

ERROR in ./packages/docs/src/index.tsx
Module build failed: (SystemJS) EISDIR: illegal operation on a directory, read
    Error: EISDIR: illegal operation on a directory, read

    Error loading /<path>/node_modules/ts-loader/dist as "./dist" from /<path>/node_modules/ts-loader/index.js
[12:40:26] Finished 'webpack-docs' after 165 ms
glennvorhes commented 7 years ago

I had the problem and resolved it by adding

  "compilerOptions": {
   ...
    "noEmitOnError": true
  },

to my tsconfig.json

It doesn't fail the individual test but the whole thing fails which I think is better than a silent failure.

giladgray commented 7 years ago

oof i wish it were that simple but there seems to be an issue with actually loading ts-loader. see the UnhandledPromiseRejectionWarning (emphasis mine):

(node:69788) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'default' of undefined

suggests some package is expecting an ES6 default export and not finding one.