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
3 of 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

This comment has been minimized.

@kzc

kzc Feb 6, 2021
Author Contributor

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 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 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
* increase mocha test timeout due to circleci node-v14-latest
@lukastaegert
Copy link
Member

@lukastaegert lukastaegert commented Feb 12, 2021

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
9 checks passed
9 checks passed
@github-actions
14 (Windows)
Details
@github-actions
12 (Windows)
Details
@github-actions
10 (Windows)
Details
ci/circleci: analysis Your tests passed on CircleCI!
Details
ci/circleci: node-v10-latest Your tests passed on CircleCI!
Details
ci/circleci: node-v12-latest Your tests passed on CircleCI!
Details
ci/circleci: node-v14-latest Your tests passed on CircleCI!
Details
@codecov
codecov/patch 100.00% of diff hit (target 97.19%)
Details
@codecov
codecov/project 97.19% (+0.00%) compared to 3394ae9
Details
@kzc kzc deleted the kzc:validate branch Feb 13, 2021
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
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants