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
bug: Unit test --watchAll argument parsed incorrectly #5640
Labels
Bug: Validated
This PR or Issue is verified to be a bug within Stencil
Comments
rwaskiewicz
added
the
Bug: Validated
This PR or Issue is verified to be a bug within Stencil
label
Apr 9, 2024
Thanks! I was able to confirm this is a bug and have labeled it to get it ingested into our backlog. |
alicewriteswrongs
added a commit
that referenced
this issue
Apr 9, 2024
This fixes two bugs related to parsing of Boolean CLI arguments using the `--argName=value` type syntax. The first is a specific bug related to the `--watchAll` flag, where we previously had an improper special-case for this flag where if it was present in the CLI args in any form than we'd always also set `watch` to true: https://github.com/ionic-team/stencil/blob/76c5d5410068cdb43296911a33b20d47531383a3/src/testing/testing.ts#L235-L237 This isn't what you want if, for instance, you actually typed `--watchAll=false`! See #5640 That in turn also uncovered a bug where we weren't supporting arguments of the form `--booleanArg=false` correctly. We were doing `Boolean('false')` in that case, which does _not_ result in a value of `false` but instead a value of `true`. This is changed to instead use a check that the value equals `'true'` to turn the value into a boolean, and regression tests are added. fixes #5640 STENCIL-1259
alicewriteswrongs
added a commit
that referenced
this issue
Apr 10, 2024
This fixes a bug related to parsing of Boolean CLI arguments using the `--argName=value` type syntax. We intend to support using that syntax to pass a boolean CLI flag (like `--watch`) but actually at present the way it is 'parsed' will result in such flags always being set to true! Not good! This is because we were setting the value of the boolean CLI flag to `Boolean('false')` if you pass `--argName=false`, which does _not_ result in a value of `false` but instead a value of `true`. This is changed to instead use a check that the value equals `'true'` to turn the value into a boolean, and regression tests are added. This was noticed when investigating #5640, but that bug actually has to do with how we convert CLI arguments into a Jest configuration.
2 tasks
github-merge-queue bot
pushed a commit
that referenced
this issue
Apr 12, 2024
This fixes a bug related to parsing of Boolean CLI arguments using the `--argName=value` type syntax. We intend to support using that syntax to pass a boolean CLI flag (like `--watch`) but actually at present the way it is 'parsed' will result in such flags always being set to true! Not good! This is because we were setting the value of the boolean CLI flag to `Boolean('false')` if you pass `--argName=false`, which does _not_ result in a value of `false` but instead a value of `true`. This is changed to instead use a check that the value equals `'true'` to turn the value into a boolean, and regression tests are added. This was noticed when investigating #5640, but that bug actually has to do with how we convert CLI arguments into a Jest configuration.
Merged
alicewriteswrongs
added a commit
that referenced
this issue
Apr 15, 2024
This adds some manual string -> boolean type coercion to the code that we use to convert CLI flags to a Jest config (after parsing them with yargs). This fixes an issue documented in #5640 where boolean CLI flags like `--watchAll` were being passed to Jest as strings, instead of as booleans, so that it was not possible to _disable_ a flag by doing `--flagName=false` (the value of the flag would be set to the string `"false"` which is a truthy value). There was also a somewhat related issue with not properly parsing boolean flags in our CLI parser which was recently fixed in #5646. fixes #5640 STENCIL-1259
alicewriteswrongs
added a commit
that referenced
this issue
Apr 15, 2024
This adds some manual string -> boolean type coercion to the code that we use to convert CLI flags to a Jest config (after parsing them with yargs). This fixes an issue documented in #5640 where boolean CLI flags like `--watchAll` were being passed to Jest as strings, instead of as booleans, so that it was not possible to _disable_ a flag by doing `--flagName=false` (the value of the flag would be set to the string `"false"` which is a truthy value). There was also a somewhat related issue with not properly parsing boolean flags in our CLI parser which was recently fixed in #5646. fixes #5640 STENCIL-1259
2 tasks
Hey @maxpatiiuk I just put up a PR (#5672) which I believe fixes this issue. I published a dev build that includes the change if you want to try it out! You can install it in a stencil project like so: npm i @stencil/core@4.16.0-dev.1713194811.e1f6157 |
1 task
jcfranco
added a commit
to Esri/calcite-design-system
that referenced
this issue
Apr 16, 2024
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@stencil/core](https://stenciljs.com/) ([source](https://togithub.com/ionic-team/stencil)) | [`4.13.0` -> `4.15.0`](https://renovatebot.com/diffs/npm/@stencil%2fcore/4.13.0/4.15.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@stencil%2fcore/4.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@stencil%2fcore/4.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@stencil%2fcore/4.13.0/4.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@stencil%2fcore/4.13.0/4.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>ionic-team/stencil (@​stencil/core)</summary> ### [`v4.16.0`](https://togithub.com/ionic-team/stencil/blob/HEAD/CHANGELOG.md#-4150-2024-04-08) [Compare Source](ionic-team/stencil@v4.15.0...v4.16.0) ##### Bug Fixes * **cli:** fix a bug in CLI argument parsing ([#5646](ionic-team/stencil#5646)) ([1fdea63](ionic-team/stencil@1fdea63)), refs [#5640](ionic-team/stencil#5640) * **testing:** prevent `find` from throwing error when query has no match ([#5641](ionic-team/stencil#5641)) ([b3886aa](ionic-team/stencil@b3886aa)), closes [#5639](ionic-team/stencil#5639) ##### Features * **dev-server:** dark mode support ([#5642](ionic-team/stencil#5642)) ([89a5e40](ionic-team/stencil@89a5e40)) * **typescript:** Update dependency typescript to v5.4.5 ([#5663](ionic-team/stencil#5663)) ([2596536](ionic-team/stencil@2596536)) ### [`v4.15.0`](https://togithub.com/ionic-team/stencil/blob/HEAD/CHANGELOG.md#-4150-2024-04-08) [Compare Source](https://togithub.com/ionic-team/stencil/compare/v4.14.1...v4.15.0) ##### Features - **compiler:** perform automatic key insertion in more situations ([#​5594](https://togithub.com/ionic-team/stencil/issues/5594)) ([8ee071b](https://togithub.com/ionic-team/stencil/commit/8ee071bf3aae4b2240b50f7af433035c8bf8aa49)) - **typescript:** Update dependency typescript to v5.4.4 ([#​5636](https://togithub.com/ionic-team/stencil/issues/5636)) ([a463871](https://togithub.com/ionic-team/stencil/commit/a46387123082d1af9fc17b5909530597dc5b5c68)) #### [`4.14.1`](https://togithub.com/ionic-team/stencil/compare/v4.14.0...v4.14.1) ##### Bug Fixes - **compiler:** don't mistake aliased paths for collections imports ([#​5620](https://togithub.com/ionic-team/stencil/issues/5620)) ([af22bb8](https://togithub.com/ionic-team/stencil/commit/af22bb858d64b60a97ce93c86f5585ef36b31c3f)), closes [#​2319](https://togithub.com/ionic-team/stencil/issues/2319) - **runtime:** nested multiple default slot relocation ([#​5403](https://togithub.com/ionic-team/stencil/issues/5403)) ([363c07b](https://togithub.com/ionic-team/stencil/commit/363c07b4723941954dc748189a744eec01d5b74c)), partially closes [#​5335](https://togithub.com/ionic-team/stencil/issues/5335) - **runtime:** prevent ref callbacks from being called too early ([#​5614](https://togithub.com/ionic-team/stencil/issues/5614)) ([81fa375](https://togithub.com/ionic-team/stencil/commit/81fa37587eb853d42bc7f92102318a3446cdea7b)), closes [#​4074](https://togithub.com/ionic-team/stencil/issues/4074) ### [`v4.14.1`](https://togithub.com/ionic-team/stencil/blob/HEAD/CHANGELOG.md#-4141-2024-04-04) [Compare Source](https://togithub.com/ionic-team/stencil/compare/v4.14.0...v4.14.1) ##### Bug Fixes - **compiler:** don't mistake aliased paths for collections imports ([#​5620](https://togithub.com/ionic-team/stencil/issues/5620)) ([af22bb8](https://togithub.com/ionic-team/stencil/commit/af22bb858d64b60a97ce93c86f5585ef36b31c3f)), closes [#​2319](https://togithub.com/ionic-team/stencil/issues/2319) - **runtime:** nested multiple default slot relocation ([#​5403](https://togithub.com/ionic-team/stencil/issues/5403)) ([363c07b](https://togithub.com/ionic-team/stencil/commit/363c07b4723941954dc748189a744eec01d5b74c)), partially closes [#​5335](https://togithub.com/ionic-team/stencil/issues/5335) - **runtime:** prevent ref callbacks from being called too early ([#​5614](https://togithub.com/ionic-team/stencil/issues/5614)) ([81fa375](https://togithub.com/ionic-team/stencil/commit/81fa37587eb853d42bc7f92102318a3446cdea7b)), closes [#​4074](https://togithub.com/ionic-team/stencil/issues/4074) ### [`v4.14.0`](https://togithub.com/ionic-team/stencil/blob/HEAD/CHANGELOG.md#-4140-2024-04-01) [Compare Source](https://togithub.com/ionic-team/stencil/compare/v4.13.0...v4.14.0) ##### Bug Fixes - **mock-doc:** provide a local name ([#​5480](https://togithub.com/ionic-team/stencil/issues/5480)) ([2f67b35](https://togithub.com/ionic-team/stencil/commit/2f67b3526c7160a0c9ac71727c401a438d282474)), closes [#​5342](https://togithub.com/ionic-team/stencil/issues/5342) - **mock-doc:** resolve type issue for localName ([#​5595](https://togithub.com/ionic-team/stencil/issues/5595)) ([d91af87](https://togithub.com/ionic-team/stencil/commit/d91af87d4e309a2da3cb145165cf7fe3c79ac1e7)), closes [#​5342](https://togithub.com/ionic-team/stencil/issues/5342) ##### Features - **testing:** allow to set screenshot timeout option in Jest v28+ ([#​5537](https://togithub.com/ionic-team/stencil/issues/5537)) ([6df12b2](https://togithub.com/ionic-team/stencil/commit/6df12b2a445ffe431f8412758f298a6e1c8fe3ac)) - **testing:** support deep piercing with Puppeteer ([#​5481](https://togithub.com/ionic-team/stencil/issues/5481)) ([13d5d41](https://togithub.com/ionic-team/stencil/commit/13d5d4188ac0d3d8d002ce93c4ec7abdde5c8086)) - **typescript:** Update dependency typescript to v5.4.3 ([#​5588](https://togithub.com/ionic-team/stencil/issues/5588)) ([9d489e4](https://togithub.com/ionic-team/stencil/commit/9d489e42a60391d2eb88cb0f7827a9368de18140)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 5am every weekday" in timezone America/Los_Angeles, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/Esri/calcite-design-system). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI5My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Ben Elan <no-reply@benelan.dev> Co-authored-by: JC Franco <jfranco@esri.com>
alicewriteswrongs
added a commit
that referenced
this issue
Apr 17, 2024
This adds some manual string -> boolean type casting to the code that we use to convert CLI flags to a Jest config (after parsing them with yargs). This fixes an issue documented in #5640 where boolean CLI flags like `--watchAll` were being passed to Jest as strings, instead of as booleans, so that it was not possible to _disable_ a flag by doing `--flagName=false` (the value of the flag would be set to the string `"false"` which is a truthy value). There was also a somewhat related issue with not properly parsing boolean flags in our CLI parser which was recently fixed in #5646. Note that to get this working it was necessary to make some module resolution-related changes in a few places since there's now a dependency between the `testing/` and `cli/` modules (`testing/` now imports and using `BOOLEAN_CLI_FLAGS`). This involved a `paths` alias in the TypeScript config, esbuild- and rollup-specific module mapping configuration / aliases, and a change in the Jest config to allow `@stencil/core/cli` to be resolved in all these contexts. fixes #5640 STENCIL-1259
alicewriteswrongs
added a commit
that referenced
this issue
Apr 22, 2024
This adds some manual string -> boolean type casting to the code that we use to convert CLI flags to a Jest config (after parsing them with yargs). This fixes an issue documented in #5640 where boolean CLI flags like `--watchAll` were being passed to Jest as strings, instead of as booleans, so that it was not possible to _disable_ a flag by doing `--flagName=false` (the value of the flag would be set to the string `"false"` which is a truthy value). There was also a somewhat related issue with not properly parsing boolean flags in our CLI parser which was recently fixed in #5646. Note that to get this working it was necessary to make some module resolution-related changes in a few places since there's now a dependency between the `testing/` and `cli/` modules (`testing/` now imports and using `BOOLEAN_CLI_FLAGS`). This involved a `paths` alias in the TypeScript config, esbuild- and rollup-specific module mapping configuration / aliases, and a change in the Jest config to allow `@stencil/core/cli` to be resolved in all these contexts. fixes #5640 STENCIL-1259
github-merge-queue bot
pushed a commit
that referenced
this issue
Apr 22, 2024
…5672) This adds some manual string -> boolean type casting to the code that we use to convert CLI flags to a Jest config (after parsing them with yargs). This fixes an issue documented in #5640 where boolean CLI flags like `--watchAll` were being passed to Jest as strings, instead of as booleans, so that it was not possible to _disable_ a flag by doing `--flagName=false` (the value of the flag would be set to the string `"false"` which is a truthy value). There was also a somewhat related issue with not properly parsing boolean flags in our CLI parser which was recently fixed in #5646. Note that to get this working it was necessary to make some module resolution-related changes in a few places since there's now a dependency between the `testing/` and `cli/` modules (`testing/` now imports and using `BOOLEAN_CLI_FLAGS`). This involved a `paths` alias in the TypeScript config, esbuild- and rollup-specific module mapping configuration / aliases, and a change in the Jest config to allow `@stencil/core/cli` to be resolved in all these contexts. fixes #5640 STENCIL-1259
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
Stencil Version
4.15.0
Current Behavior
Regardless of the argument value, if the argument is present, Stencil sets
watch=true
:stencil/src/testing/testing.ts
Lines 235 to 237 in 76c5d54
This causes this command to be incorrectly interpreted as if
watchAll
is true:npx stencil test --spec -- --watchAll=false
Besides confusion, this causes third-party tools to fail or freeze: jest-community/vscode-jest#1124 (comment)
Expected Behavior
If
--watchAll
is false, it should not be treated as atrue
Jest's documentation explicitly mentions this:
https://github.com/jestjs/jest/blob/726ca20752e38c18e20aa21740cec7aba7891946/docs/CLI.md?plain=1#L545
For reference, Jest defines it as a boolean argument using the
typebox
library:https://github.com/jestjs/jest/blob/726ca20752e38c18e20aa21740cec7aba7891946/packages/jest-schemas/src/raw-types.ts#L346
Which would parse the value as false if it's anything other than
true
: https://github.com/sinclairzx81/typebox/blob/480ba12942cf908fab6e2ad16b3276b035ddcb54/test/runtime/value/cast/boolean.ts#L5System Info
Steps to Reproduce
Run
npx stencil test --spec -- --watchAll=false
Code Reproduction URL
https://github.com/maxpatiiuk/vscode-jest-bug-reproduction
Additional Information
No response
The text was updated successfully, but these errors were encountered: