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

implement validate output option and --validate CLI option #3952

Merged
merged 6 commits into from Feb 12, 2021
Merged

implement validate output option and --validate CLI option #3952

merged 6 commits into from Feb 12, 2021

Conversation

kzc
Copy link
Contributor

@kzc kzc commented Feb 6, 2021

  • optionally verifies the generated output by parsing it with acorn
  • disabled by default
  • enable the validate option in the majority of tests

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:

#3951 (comment)

Description

#3951 brought to light that a few of the test cases have ill-formed output in the rollup test suite. This PR is an attempt to prevent that from happening in the future. The validate option can also give users an extra bit of confidence that there are no syntax errors in their rollup generated bundles.

@kzc kzc mentioned this pull request Feb 6, 2021
9 tasks
@@ -47,7 +47,8 @@ runTestSuiteWithSamples('form', path.resolve(__dirname, 'samples'), (dir, config
{
exports: 'auto',
file: inputFile,
format: defaultFormat
format: defaultFormat,
// validate: true // add when systemjs bugs fixed
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Commented out to pass tests.
Enable validation here to see the issues related to:

test/form/samples/system-export-compact/_expected.js
test/form/samples/system-multiple-export-bindings/_expected.js
test/form/samples/no-external-live-bindings-compact/_expected/system.js

@codecov
Copy link

codecov bot commented Feb 7, 2021

Codecov Report

Merging #3952 (4e809ca) into master (3394ae9) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3952   +/-   ##
=======================================
  Coverage   97.19%   97.19%           
=======================================
  Files         191      191           
  Lines        6694     6703    +9     
  Branches     1958     1960    +2     
=======================================
+ Hits         6506     6515    +9     
  Misses         99       99           
  Partials       89       89           
Impacted Files Coverage Δ
src/utils/options/mergeOptions.ts 100.00% <ø> (ø)
src/Bundle.ts 100.00% <100.00%> (ø)
src/utils/error.ts 100.00% <100.00%> (ø)
src/utils/options/normalizeOutputOptions.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 3394ae9...4e809ca. Read the comment docs.

kzc and others added 3 commits February 7, 2021 17:47
* optionally verifies the generated output by parsing it with acorn
* disabled by default
* enable the validate option in the majority of tests
* increase mocha test timeout due to circleci node-v14-latest
@lukastaegert
Copy link
Member

Thanks, while it may not be useful often, this could also serve as a helper option for plugin developers, so I decided to merge this. I extended the documentation and slightly refined the error generation and tests.

@lukastaegert lukastaegert merged commit 0e3445b into rollup:master Feb 12, 2021
@kzc kzc deleted the validate branch February 13, 2021 06:26
This was referenced Mar 11, 2021
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.

None yet

2 participants