My main Web project fails to build due to a Typescript/import error (I assume because the reference is looking for something in node_modules).
Build\scripts\data\UserApi.ts (1, 38): BuildCannot find module '../../../node_modules/axios/index'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?
However, the project runs fine on F5 and indeed the Typescript works fine (Axios in this case makes HTTP requests as expected).
Any ideas how I can get NCrunch to ignore TS/node dependencies entirely? I only want it running my C#/serverside tests.
OK by right clicking the project that is failing to build in the nCrunch Tests window, go to Advanced and then from there you can browse to the folder where nCrunch builds the project. I watched a couple of times and realised that I don't have anything telling nCrunch to npm install (or similar).
Is there a recommended way to set this up?
I am using VS 2019 if it matters.
Is there a recommended way to set this up?
I am using VS 2019 if it matters.
Remco NCrunch Developer
#15267
24 Jan 2021 00:42 UTC
Hi, thanks for sharing this issue.
Broadly, you have two options here. You can either disable typescript compilation by adding a condition to your project file, or you can make sure it has the dependencies necessary to run without errors inside the NCrunch workspace.
The root issue is that your typescript build step requires certain files to be present on paths relative to the solution being compiled. These files haven't been auto detected by NCrunch, so they don't get copied into its workspace when it builds your project. You'll need to specify the files using the additional files to include setting so then NCrunch is aware of them and can copy them over. Probably it's best to just include the entire node_modules directory. Hopefully that will resolve the issue and you'll be able to have typescript compilation results showing up in the NCrunch Tests Window.
Broadly, you have two options here. You can either disable typescript compilation by adding a condition to your project file, or you can make sure it has the dependencies necessary to run without errors inside the NCrunch workspace.
The root issue is that your typescript build step requires certain files to be present on paths relative to the solution being compiled. These files haven't been auto detected by NCrunch, so they don't get copied into its workspace when it builds your project. You'll need to specify the files using the additional files to include setting so then NCrunch is aware of them and can copy them over. Probably it's best to just include the entire node_modules directory. Hopefully that will resolve the issue and you'll be able to have typescript compilation results showing up in the NCrunch Tests Window.
Makes sense, thanks for the quick reply.
Came across this post while looking to disable typescript build from ncrunch. With the link on conditions from here plus a page from somewhere else, here's the simple way:
<PropertyGroup>
<TypeScriptCompileBlocked Condition="'$(NCrunch)' == '1'">true</TypeScriptCompileBlocked>
</PropertyGroup>Post a reply
Log in to reply.