madskristensen / NpmTaskRunner

Visual Studio extension
Other
88 stars 32 forks source link

Reserved script name appearing under "Custom" node #29

Closed scottaddie closed 8 years ago

scottaddie commented 8 years ago

Installed product versions

When both a preuninstall and a postuninstall script are defined in the scripts section of package.json, my preversion script appears under the "Custom" node in TRX.

Steps to recreate

  1. Create a new ASP.NET app with a package.json file.
  2. Add the following scripts to package.json:
  "scripts": {
    "foo": "echo foo",
    "preuninstall": "echo preuninstall",
    "postuninstall": "echo postuninstall",
    "preversion": "echo preversion"
  }

Current behavior

The following screenshot depicts the current behavior:

before_fix

Since version is a reserved npm script name, the preversion script should appear under the "Defaults" node in TRX. An exception is being thrown and swallowed by the catch block in the LoadTasks method of TaskParser.cs. The exception is caused by adding the "uninstall" key to a List twice.

Expected behavior

The preversion script should appear under a read-only version node within TRX's "Defaults" node:

after_fix

scottaddie commented 8 years ago

This was fixed with commit https://github.com/madskristensen/NpmTaskRunner/commit/e21176ab98865c420d26afb907b0aa06e44aa2c1