Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: implement --failAfterWarnings flag #3712

Merged
merged 11 commits into from Aug 14, 2020

Conversation

tjenkinson
Copy link
Member

@tjenkinson tjenkinson commented Aug 10, 2020

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers: closes #3021

Description

Adds the --failAfterWarnings flag which when provided causes the command to error if there were any warnings.

TODO

  • It looks like the expected output is not checked with error: () => true

@@ -0,0 +1,5 @@
'use strict';

require('unknown');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think this is been checked with error: () => true in this or other tests. will investigate

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do. I checked e.g. node-config-not-found and changing the expected output there turned the test red.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case it's because I wasn't returning true to make it continue. In the other tests where _expected.js was being ignored I removed _expected.js because they didn't match, and I'm not sure if the intent was to check the output or not?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to return true in order to continue

if (!shouldContinue) return done();

_expected.js should be compared to stdout, but only if there is no _expected dir, config.test, config.result, config.execute, config.stderr that does not return true or config.error that does not return true.

@codecov
Copy link

codecov bot commented Aug 10, 2020

Codecov Report

Merging #3712 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3712   +/-   ##
=======================================
  Coverage   96.96%   96.97%           
=======================================
  Files         184      184           
  Lines        6402     6408    +6     
  Branches     1854     1855    +1     
=======================================
+ Hits         6208     6214    +6     
  Misses        103      103           
  Partials       91       91           
Impacted Files Coverage Δ
src/utils/options/mergeOptions.ts 100.00% <ø> (ø)
cli/run/batchWarnings.ts 98.43% <100.00%> (+0.03%) ⬆️
cli/run/index.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fdb31b7...0c58941. Read the comment docs.

@lukastaegert
Copy link
Member

Nice work. I will try to have a proper look shortly.

@tjenkinson tjenkinson marked this pull request as ready for review August 11, 2020 16:46
cli/run/index.ts Outdated Show resolved Hide resolved
cli/run/batchWarnings.ts Outdated Show resolved Hide resolved
cli/run/index.ts Outdated Show resolved Hide resolved
@@ -49,6 +49,7 @@ Basic options:
--preserveSymlinks Do not follow symlinks when resolving files
--shimMissingExports Create shim variables for missing exports
--silent Don't print warnings
--failAfterWarnings Exit with an error code if there was a warning during the build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to extend documentation in the docs folder, just check where and how e.g. --enivronment is documented.

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks a lot! I'll publish this shortly. I think I will likely use this flag for Rollup's own build in upcoming versions myself.

@lukastaegert lukastaegert merged commit 943b60e into rollup:master Aug 14, 2020
wchargin added a commit to tensorflow/tensorboard that referenced this pull request Aug 21, 2020
Summary:
We’ve recently eliminated all Rollup warnings. This prevents regression.

Rollup upgrade needed for `--failAfterWarnings`, added recently:
<rollup/rollup#3712>

Test Plan:
Modify the `onwarn` handler in our `rollup_config.js` to remove any of
the early-`return`s, and note that `bazel build //tensorboard` fails.

wchargin-branch: rollup-no-warn
wchargin-source: 8019e8292a51aa9f74cae2d1acc8b0e5ce47cdb2
wchargin added a commit to tensorflow/tensorboard that referenced this pull request Aug 21, 2020
Summary:
We’ve recently eliminated all Rollup warnings. This prevents regression.

Rollup upgrade needed for `--failAfterWarnings`, added recently:
<rollup/rollup#3712>

Test Plan:
Modify the `onwarn` handler in our `rollup_config.js` to remove any of
the early-`return`s, and note that `bazel build //tensorboard` fails.

wchargin-branch: rollup-no-warn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add CLI option to fail with warnings
2 participants