-
Notifications
You must be signed in to change notification settings - Fork 785
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: broken support for yarn executing tests #3482
Comments
Hello @jeripeierSBB, thanks for filing this issue! I was just able to validate that this is occurring. It look to be an issue specific to yarn, since in your reproduction case I am able to run the In any case, I'm going to add this to the backlog and hopefully we'll have a fix soon for running scripts like these w/ |
@alicewriteswrongs thanks for getting into this. I have to mention that with version 2.17.0 it worked, so this problem was newly introduced with version 2.17.1 |
That makes sense, this recent pr #3444 was included in the 2.17.1 release, so it makes sense that the behavior changed then. |
edit: disregard this! commented on the wrong PR 🤦♀️ |
@jeripeierSBB would you mind providing some information about the version of yarn you're using, and how you had this working before upgrading to |
Hi, This issue is happening with NPM as well. Worked fine till
Issue:
|
@manojreddymettu-pro I believe that is a separate issue, see #3481 and #3471 |
This removes some code from our argument parsing implementation which would look for an environment variable (`npm_config_argv`) set by npm and, if present, merge CLI flags found their into the ones already present on `process.argv`. We want to remove this for two reasons: - `npm_config_argv` is deprecated in `npm`, so in newer versions of the package manager it is no longer set and our code referencing it is effectively doing nothing - `yarn` v1.x still sets it (presumably for compatibility with `npm` that hasn't been removed yet, which causes an inconsistency between `npm` and `yarn` where certain `package.json` scripts will run without issue in `npm` but fail in `yarn` (see #3482) Accordingly, this commit deletes the offending function from `src/cli/parse-flags.ts` and makes a few related changes at call sites, etc which are necessary due to that change. This commit also refactors the spec file for `parse-flags.ts` to remove redundant tests. Because all of the supported CLI arguments (i.e. those added to `knownArgs`) are defined in `ReadonlyArray<string>` variables we can do a lot of exhaustive testing of all the arguments, set in the various possible permutations, etc, so we don't need to define a bunch of individual tests. Accordingly, the test file is refactored to remove redundant tests, add a few more test cases for the exhaustive tests, organize things a bit more with `describe` blocks, and ensure that we have good tests around all off the 'edge-case-ey' things.
This removes some code from our argument parsing implementation which would look for an environment variable (`npm_config_argv`) set by npm and, if present, merge CLI flags found their into the ones already present on `process.argv`. We want to remove this for two reasons: - `npm_config_argv` is deprecated in `npm`, so in newer versions of the package manager it is no longer set and our code referencing it is effectively doing nothing - `yarn` v1.x still sets it (presumably for compatibility with `npm` that hasn't been removed yet, which causes an inconsistency between `npm` and `yarn` where certain `package.json` scripts will run without issue in `npm` but fail in `yarn` (see #3482) Accordingly, this commit deletes the offending function from `src/cli/parse-flags.ts` and makes a few related changes at call sites, etc which are necessary due to that change. This commit also refactors the spec file for `parse-flags.ts` to remove redundant tests. Because all of the supported CLI arguments (i.e. those added to `knownArgs`) are defined in `ReadonlyArray<string>` variables we can do a lot of exhaustive testing of all the arguments, set in the various possible permutations, etc, so we don't need to define a bunch of individual tests. Accordingly, the test file is refactored to remove redundant tests, add a few more test cases for the exhaustive tests, organize things a bit more with `describe` blocks, and ensure that we have good tests around all off the 'edge-case-ey' things.
This removes some code from our argument parsing implementation which would look for an environment variable (`npm_config_argv`) set by npm and, if present, merge CLI flags found their into the ones already present on `process.argv`. We want to remove this for two reasons: - `npm_config_argv` is deprecated in `npm`, so in newer versions of the package manager it is no longer set and our code referencing it is effectively doing nothing - `yarn` v1.x still sets it (presumably for compatibility with `npm` that hasn't been removed yet, which causes an inconsistency between `npm` and `yarn` where certain `package.json` scripts will run without issue in `npm` but fail in `yarn` (see #3482) Accordingly, this commit deletes the offending function from `src/cli/parse-flags.ts` and makes a few related changes at call sites, etc which are necessary due to that change. This commit also refactors the spec file for `parse-flags.ts` to remove redundant tests. Because all of the supported CLI arguments (i.e. those added to `knownArgs`) are defined in `ReadonlyArray<string>` variables we can do a lot of exhaustive testing of all the arguments, set in the various possible permutations, etc, so we don't need to define a bunch of individual tests. Accordingly, the test file is refactored to remove redundant tests, add a few more test cases for the exhaustive tests, organize things a bit more with `describe` blocks, and ensure that we have good tests around all off the 'edge-case-ey' things.
This removes some code from our argument parsing implementation which would look for an environment variable (`npm_config_argv`) set by npm and, if present, merge CLI flags found their into the ones already present on `process.argv`. We want to remove this for two reasons: - `npm_config_argv` is deprecated in `npm` v7+, so in newer versions of the package manager it is no longer set and our code referencing it is effectively doing nothing - `yarn` v1.x still sets it (presumably for compatibility with `npm` that hasn't been removed yet, which causes an inconsistency between `npm` and `yarn` where certain `package.json` scripts will run without issue in `npm` but fail in `yarn` (see #3482) Accordingly, this commit deletes the offending function from `src/cli/parse-flags.ts` and makes a few related changes at call sites, etc which are necessary due to that change. This commit also refactors the spec file for `parse-flags.ts` to remove redundant tests. Because all of the supported CLI arguments (i.e. those added to `knownArgs`) are defined in `ReadonlyArray<string>` variables we can do a lot of exhaustive testing of all the arguments, set in the various possible permutations, etc, so we don't need to define a bunch of individual tests. Accordingly, the test file is refactored to remove redundant tests, add a few more test cases for the exhaustive tests, organize things a bit more with `describe` blocks, and ensure that we have good tests around all off the 'edge-case-ey' things.
@jeripeierSBB to update you, we merged a PR today (#3486) which I believe fixes the underlying issue you're running in to here. If you want to test it out to make sure it fixes your issue you could:
If you'd rather wait for a pre-release or release build to try that out no worries, we will be doing one soon. Thanks again for reporting this issue! |
@alicewriteswrongs Thanks for all your work on it and sorry for my late response. I'm using yarn v1.22.19, and in my project it really worked with stencil 2.17.0. I tested your fix and it works with yarn, thank you! Should I close the issue myself? |
Glad the fixed worked for you! Thanks again for reporting the issue, it
pointed the way to a problematic little bit of code that was good to
eliminate.
As for the issue, we can leave it open until the fixed is released just so
that it will continue to show up as open for anyone else who experiences
the problem on a current stencil release.
…On Mon, Jul 25, 2022 at 9:40 AM Jeri Peier ***@***.***> wrote:
providing some information about the version of yarn you're using, and how
yo
@alicewriteswrongs <https://github.com/alicewriteswrongs> Thanks for all
your work on it and sorry for my late response. I'm using yarn v1.22.19,
and in my project it really worked with stencil 2.17.0.
I tested your fix and it works with yarn, thank you! Should I close the
issue myself?
—
Reply to this email directly, view it on GitHub
<#3482 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABPLRHBAWKBEEXPIAGFUI6TVV2KNVANCNFSM54D3REVQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
The fix for this issue has been officially released as a part of Stencil v2.17.2. As a result, I'm going to close this issue and mark it as completed. If the bug re-appears, please feel free to open a new issue! |
Prerequisites
Stencil Version
2.17.1
Current Behavior
Executing
yarn test
with another script name astest
fails.Consider the following example specified in package.json scripts section:
if executing
yarn test:dev
it fails and the following output is generated:Expected Behavior
Tests should be executed as before version 2.17.1
Steps to Reproduce
npm init stencil
yarn
test:dev
inpackage.json
yarn test:dev
Code Reproduction URL
https://github.com/jeripeierSBB/stencil-yarn-fail-repro
Additional Information
No response
The text was updated successfully, but these errors were encountered: