My scenario:
I want to use VS to debug a Jasmine test. There are two directories involved: Jasmine, and my foo-spec.js code.
In my "stock project" intended to run arbitrary Jasmine foo-spec.js files, I let Jasmine itself be the startup file. e.g. in spec.njsproj I have:
<StartupFile>..\..\..\..\node_modules\jasmine-node\lib\jasmine-node\cli.js</StartupFile>
Next up is to add foo-spec.js and other Javascript files that is "required" by foo-spec.js. Because requires uses relative paths, I must add these items to my project as links, rather than the default behavior where Visual Studio makes a copy of the js file in the project directory. (For those who don't know how this is done: you Right click project, Add Existing Item, select file, choose the dropdown arrow on Add, and choose Add as Link.) This works: I can set breakpoints, run and debug.
Here's the problem: if I close the project and reopen it, the linked js files disappear.
If I inspect spec.njsproj, I see that the linked file is there:
<Compile Include="..\..\..\foo\spec\foo-spec.js">
<Link>..\build_env\tools\foo\spec\foo-spec.js</Link>
</Compile>
I can explain the relative path ..\build_env\tools\foo\spec. It is relative to the location of the project file (spec.njsproj). I can't explain the relative path ..\..\..\foo\spec\. I tried correcting these to be relative to the project root, to no avail.
It seems like adding js files AS LINKS is a very common scenario for node.js projects due to the prevalent use of requires.
Is there something I'm doing wrong? Has anyone succeeded in roundtripping links through the project file?
I want to use VS to debug a Jasmine test. There are two directories involved: Jasmine, and my foo-spec.js code.
In my "stock project" intended to run arbitrary Jasmine foo-spec.js files, I let Jasmine itself be the startup file. e.g. in spec.njsproj I have:
<StartupFile>..\..\..\..\node_modules\jasmine-node\lib\jasmine-node\cli.js</StartupFile>
Next up is to add foo-spec.js and other Javascript files that is "required" by foo-spec.js. Because requires uses relative paths, I must add these items to my project as links, rather than the default behavior where Visual Studio makes a copy of the js file in the project directory. (For those who don't know how this is done: you Right click project, Add Existing Item, select file, choose the dropdown arrow on Add, and choose Add as Link.) This works: I can set breakpoints, run and debug.
Here's the problem: if I close the project and reopen it, the linked js files disappear.
If I inspect spec.njsproj, I see that the linked file is there:
<Compile Include="..\..\..\foo\spec\foo-spec.js">
<Link>..\build_env\tools\foo\spec\foo-spec.js</Link>
</Compile>
I can explain the relative path ..\build_env\tools\foo\spec. It is relative to the location of the project file (spec.njsproj). I can't explain the relative path ..\..\..\foo\spec\. I tried correcting these to be relative to the project root, to no avail.
It seems like adding js files AS LINKS is a very common scenario for node.js projects due to the prevalent use of requires.
Is there something I'm doing wrong? Has anyone succeeded in roundtripping links through the project file?