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

NPM tasks using the same script name from different cwd's cannot be used distinctively in WSL #120913

Closed
piejanssens opened this issue Apr 9, 2021 · 4 comments
Assignees
Labels
*as-designed Described behavior is as designed tasks Task system issues

Comments

@piejanssens
Copy link

  • VS Code Version: 1.55.1

  • OS Version: Linux BE-PC1HY22Y 5.4.72-microsoft-standard-WSL2 use another key binding prefix than cmd+n vscode-npm-scripts#1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

  • Version: 1.55.1 (user setup)

  • Commit: 08a217c

  • Date: 2021-04-07T15:06:02.360Z

  • Electron: 11.3.0

  • Chrome: 87.0.4280.141

  • Node.js: 12.18.3

  • V8: 8.7.220.31-electron.0

  • OS: Windows_NT x64 10.0.19042

Steps to Reproduce:

Use VS Code in WSL. I cannot reproduce the issue when I reopen the same project window under [Windows.](url
tasks-issue.zip
)

You can find the sample project structure attached and skip steps 1-4

  1. Create the project structure
mkdir tasks-issue && cd tasks-issue
mkdir subfolder
npm init --yes
cd subfolder
npm init --yes
  1. Open /package.json and replace the echo script with this
    "test": "echo \"NPM script from root\" && exit 1"
  1. Open `/subfolder/package.json' and change the echo text from the test script to indicate this echo comes from the subfolder package script
    "test": "echo \"NPM script from subfolder\" && exit 1"
  1. Create a .vscode/tasks.json with the following contents
{
  // See https://go.microsoft.com/fwlink/?LinkId=733558
  // for the documentation about the tasks.json format
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Start root",
      "type": "npm",
      "script": "test",
      "presentation": {
        "reveal": "always",
        "panel": "new",
        "group": "ensemble"
      }
    },
    {
      "label": "Start subfolder",
      "type": "npm",
      "script": "test",
      "path": "dummy", //uncomment path to 'fix' the issue
      "options": {
        "cwd": "${workspaceFolder}/subfolder"
      },
      "presentation": {
        "reveal": "always",
        "panel": "new",
        "group": "ensemble"
      }
    },
    {
      "label": "Run Both",
      "dependsOn": ["Start root", "Start subfolder"],
      "group": "test"
    }
  ]
}
  1. Use global menu and select "Run Task"

Observations:

  1. Task "Start subfolder" is missing
  2. Run task "Run Both" and notice that it only executes "Start root"
  3. Uncomment line 20 in tasks.json and notice that both issues from the observations 1 and 2 are gone

Does this issue occur when all extensions are disabled?: Yes

@vscodebot
Copy link

vscodebot bot commented Apr 9, 2021

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@piejanssens piejanssens changed the title Two npm tasks using the same script name from different cwd's cannot be used distinctively in WSL NPM tasks using the same script name from different cwd's cannot be used distinctively in WSL Apr 9, 2021
@piejanssens
Copy link
Author

The bot guessed it right (impressive! - I didn't find that issue with a manual search), #116705 seems very similar.
The author has reported it microsoft/vscode-js-debug#1321
He is reporting the issue on native macOS, so this might be a unix issue, not directly WSL related.

Since the npm extension is now built-in, I hope my issue doesn't get closed and banned to report it in the extension vscode-npm-scripts as there is not much activity going on if I look at the open issues and PR's...

@alexr00 alexr00 added bug Issue identified by VS Code Team member as probable bug tasks Task system issues and removed new release labels Apr 9, 2021
@alexr00 alexr00 added this to the April 2021 milestone Apr 9, 2021
@alexr00 alexr00 removed the bug Issue identified by VS Code Team member as probable bug label Apr 15, 2021
@alexr00 alexr00 removed this from the April 2021 milestone Apr 15, 2021
@alexr00
Copy link
Member

alexr00 commented Apr 15, 2021

@piejanssens thank you for the very clear steps! The path value for your subfolder task actually needs to be the path to the subfolder for the npm extension and the tasks system to be able to tell which task you're trying to configure in your tasks.json file.

		{
			"type": "npm",
			"script": "test",
			"path": "subfolder/",
			"group": "test",
			"problemMatcher": [],
			"label": "npm: test - subfolder",
		}

@alexr00 alexr00 added the *as-designed Described behavior is as designed label Apr 15, 2021
@github-actions github-actions bot locked and limited conversation to collaborators May 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*as-designed Described behavior is as designed tasks Task system issues
Projects
None yet
Development

No branches or pull requests

3 participants
@piejanssens @alexr00 and others