Chutzpah running both .ts and .js tests (the tests are effectively the same so the test count is doubled) - chutzpah

In Visual Studio, right-click on a .ts file and "Run JS Tests", only the tests in the .ts file run and are counted in the total.
"Run JS Tests" at the folder level or project level and both the tests in the .ts and .js files are run and counted in the total.
Chutzpah.json settings:
{
"Framework": "jasmine",
"TypeScriptCodeGenTarget": "ES5",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"RootReferencePathMode": "SettingsFileDirectory",
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ]
},
"Tests": [
{ "Path": "Specs"}
]
}

I had the same issue. All my tests are written in TypeScript, so my *.ts files define what tests exist. I had solved it by including only *.ts files.
{
"Tests": [ { "Path": "Specs", "Includes": [ "*.ts" ] } ],
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ]
}
}
Works like a charm.

Without seeing your full project it is hard to know for sure but something along the following should help achieve this. If you need to include some .js files you can change the exclude patterns accordingly.
```
{
"Framework": "jasmine",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"RootReferencePathMode": "SettingsFileDirectory",
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ]
},
"References": [
{ "Excludes": ["*.js"]}
],
"Tests": [
{ "Path": "Specs", "Excludes": ["*.js"]}
]
}
```

Related

How to add "portable" to the electron builder .exe file name?

This is my package.json build data:
"build": {
"appId": "name.desktop",
"productName": "name",
"beforePack": "electron/beforePack.js",
"extraResources": [
{
"from": "bin/${os}",
"to": "bin",
"filter": [
"**/*"
]
}
],
"files": [
"build/**/*",
"electron/**/*",
"package.json"
],
"extends": null,
"mac": {
"target": "dmg",
"type": "distribution"
},
"win": {
"target": [
"portable",
"nsis"
]
},
"linux": {
"target": "AppImage"
}
}
I'm looking to add "portable" to the windows portable file name, so that the .exe is "name 1.0.0 portable.exe" instead of "name 1.0.0.exe"
It is possible to explicitely define the generated file names at each relevant level in the package.json file by making use of an "artifactName" property.
This is documented in the Overridable per Platform Options section of the Common Configuration - electron-builder page:
Following options can be set also per platform (top-level keys mac, linux and win) if need.
artifactName String | “undefined” - The artifact file name template. Defaults to ${productName}-${version}.${ext} (some target can have other defaults, see corresponding options).
which indirectly refers to the File Macros section of the File Patterns - electron-builder page.
In your specific case, you'll have to add the following "artifactName" property to your package.json file at the Windows version level:
"artifactName": "${name} ${version} portable.${ext}",
i.e.:
"build": {
"appId": "name.desktop",
"productName": "name",
"beforePack": "electron/beforePack.js",
"extraResources": [
{
"from": "bin/${os}",
"to": "bin",
"filter": [
"**/*"
]
}
],
"files": [
"build/**/*",
"electron/**/*",
"package.json"
],
"extends": null,
"mac": {
"target": "dmg",
"type": "distribution"
},
"win": {
"artifactName": "${name} ${version} portable.${ext}",
"target": [
"portable",
"nsis"
]
},
"linux": {
"target": "AppImage"
}
}

How have VS Code/Intellisense recognize glib C/C++ on Windows 10

I am wracking my brain trying to figure out how to have VS Code recognize glib.
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (Q:\code\srctext\text_lexer.c).C/C++(1696)
cannot open source file "glibconfig.h" (dependency of "glib-2.0/gmodule.h")C/C++(1696)
I have manually built glib and have the following *.dll and *.pdb files:
gio-2.0-0
glib-2.0-0
gmodule-2.0-0
gobject-2.0-0
gthread-2.0-0
but I do not know if this is necessary to include when vcpkg has it installed?
I have installed glib using vcpkg (Package glib:x86-windows is already installed).
Thanks!
I'm not sure what combination of corrections did the trick, but the errors went away when my c_cpp_properties.json file looked like below.
c_cpp_properties.json
{
"configurations": [
{
"name": "Win32Debug",
"includePath": [
"${workspaceFolder}/include/debug/**",
"C:/sync/name/code/projects/frameworks/projectA/projectA/include/**",
"C:/sync/name/code/libraries/c c++/GTK/glib/lib/glib-2.0/include",
"C:/sync/name/code/libraries/c c++/GTK/glib/include/glib-2.0"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.18362.0",
"cStandard": "c17",
"cppStandard": "c++20",
"intelliSenseMode": "windows-gcc-x86",
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": "${default}",
"path": [
"${workspaceFolder}/include/debug/**",
"C:/sync/name/code/projects/frameworks/projectA/projectA/include/debug/**",
"C:/sync/name/code/libraries/c c++/GTK/glib/lib/glib-2.0/include",
"C:/sync/name/code/libraries/c c++/GTK/glib/include/glib-2.0"
]
},
"compilerArgs": [],
"compilerPath": "C:/msys64/mingw64/bin/gcc.exe",
"forcedInclude": [
"${default}"
]
},
{
"name": "Win64Debug",
"includePath": [
"${workspaceFolder}/include/debug/**",
"D:/backup/sync/name/code/projects/frameworks/projectA/projectA/include/debug/**",
"D:/backup/sync/name/code/libraries/c c++/GTK/glib/lib/glib-2.0/include",
"D:/backup/sync/name/code/libraries/c c++/GTK/glib/include/glib-2.0"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.18362.0",
"compilerPath": "C:/msys64/mingw64/bin/gcc.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "linux-gcc-x64",
"compilerArgs": [],
"browse": {
"path": [
"${workspaceFolder}/include/debug/**",
"C:/sync/name/code/projects/frameworks/projectA/projectA/include/debug/**",
"C:/sync/name/code/libraries/c c++/GTK/glib/lib/glib-2.0/include",
"C:/sync/name/code/libraries/c c++/GTK/glib/include/glib-2.0"
],
"limitSymbolsToIncludedHeaders": true
}
}
],
"version": 4
}
Not sure if tasks.json had any influence (frankly Visual Code's inner workings are an opaque impenetrable blob to my attempts at understanding), but just in case:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "C/C++ g++.exe build",
"command": "C:\\msys64\\mingw64\\bin\\g++.exe",
"args": [
"/property:GenerateFullPaths=true",
"/t:build",
"/consoleloggerparameters:NoSummary",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}",
"--include-directory=C:/sync/name/code/libraries/c c++/GTK/glib/lib/**"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "silent"
},
"problemMatcher": [
"$gcc"
]
}
]
}

Visual Studio File Nesting for gRPC proto files

I have a load of .proto files that generate an associated .cs file, and i also have a partial .cs file, all of the same name:
message.proto
message.cs (autogenerated in the obj\debug
directory)
mesasge.cs (in the same folder as the proto file)
I am trying to get them nesting with Visual Studio 2019, but unable. Pointers much appreciated as to what i am doing wrong.
{
"help": "https://go.microsoft.com/fwlink/?linkid=866610",
"root": true,
"dependentFileProviders": {
"add": {
"addedExtension": {},
"pathSegment": {
"add": {
".*": [
".js",
".css",
".html",
".htm",
".less",
".scss",
".coffee",
".iced",
".config",
".cs",
".vb",
".json",
".proto"
]
}
},
"extensionToExtension": {
"add": {
".proto": [
".cs"
],
".js": [
".coffee",
".iced",
".ts",
".tsx",
".jsx"
],
".css": [
".less",
".scss",
".sass",
".styl"
],
".html": [
".md",
".mdown",
".markdown",
".mdwn"
],
".map": [
".js",
".css"
],
".svgz": [
".svg"
],
".designer.cs": [
".resx"
],
".cs.d.ts": [
".cs"
]
}
},
"fileToFile": {
"add": {
".bowerrc": [
"bower.json"
],
".npmrc": [
"package.json"
],
"npm-shrinkwrap.json": [
"package.json"
],
"yarn.lock": [
"package.json"
],
".yarnclean": [
"package.json"
],
".yarnignore": [
"package.json"
],
".yarn-integrity": [
"package.json"
],
".yarnrc": [
"package.json"
],
"package-lock.json": [
"package.json"
]
}
},
"fileSuffixToExtension": {
"add": {
"-vsdoc.js": [
".js"
]
}
},
"allExtensions": {
"add": {
".*": [
".tt"
]
}
}
}
}
}

DocFX: Generate API documentation for multiple projects

I'm working on a project that has multiple projects in a solution. I would like to be able to generate the documentation from an outside directory to keep the application code folders clean. When I try to set the src directory in my docfx.json, it doesn't seem to like absolute paths, nor does it like relative paths.
{
"metadata":
[{
"src":
[{
"files": ["../../../Repos/Wsi.Extranet.CommonServices/Wsi.Extranet.CommonServices/**/*.csproj"]
"exclude":
[
"**/obj/**",
"**/bin/**",
"_site/**"
]
}],
"dest": "api"
}],
"build": {
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
]
},
{
"files": [
"articles/**.md",
"articles/**/toc.yml",
"toc.yml",
"*.md"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"resource": [
{
"files": [
"images/**"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"overwrite": [
{
"files": [
"apidoc/**.md"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"src": "../../../Repos/Wsi.Extranet.CommonServices/Wsi.Extranet.CommonServices",
"dest": "_site",
"globalMetadataFiles": [],
"fileMetadataFiles": [],
"template": [
"default"
],
"postProcessors": [],
"noLangKeyword": false
}
}
It says it built fine but didn't find any files and the directory that it searches for is staying in the current directory.
D:\temp\WsiApiDocs\docfx_project>docfx metadata
Info: Config file docfx.json found, start generating metadata...
Info: No files are found with glob pattern **/*.csproj, excluding
**/obj/**,**/bin/**,_site/**, under directory "D:\temp\WsiApiDocs\docfx_project"
Info: Completed executing in 54.0087 milliseconds.
Build succeeded.
0 Warning(s)
0 Error(s)
When I attempt to put the relative path in the files property, I get the following:
D:\temp\WsiApiDocs\docfx_project>docfx metadata
Info: Config file docfx.json found, start generating metadata...
Info: No files are found with glob pattern
../../../Repos/Wsi.Extranet.CommonServices/Wsi.Extranet.CommonServices/**/*.csproj,
excluding **/obj/**,**/bin/**,_site/**, under directory
"D:\temp\WsiApiDocs\docfx_project"
**Warning: NOTE that `../` is currently not supported in glob pattern, please use `../` in `src` option instead.**
Info: Completed executing in 48.9621 milliseconds.
Build succeeded with warning.
Warning: NOTE that `../` is currently not supported in glob pattern, please use `../` in `src` option instead.
1 Warning(s)
0 Error(s)
So my confusion seems to be in how to use the src option instead. If use the src in metadata, then it seems that I can't specify the file and exclusion info. I tried to use a src property on the same level as metadata but that seemed to do nothing.
Just as the error states
../ is currently not supported in glob pattern
files, exclude etc. use glob patterns. Set a base directory instead via src:
{
"metadata": [
{
"src": [
{
"files": "Repos/Wsi.Extranet.CommonServices/Wsi.Extranet.CommonServices/**.csproj",
"exclude": [
"**/obj/**",
"**/bin/**"
],
"src": "../../.." // <---- base directory
}
],
"dest": "api"
}
],
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
]
}
// ...
]
}
Here is an exmaple of structuring multiple projects

How to generate documentation for other projects within solution using DocFx

I am using DocFx to automatically generate documentation in Visual Studio 2015.
Per the Getting Started instructions, I added an empty ASP.NET 4 Web Application and used the Nuget Console to install the DocFx build package (e.g. Install-Package docfx.msbuild). I built the site and it it generated documentation for code within the project.
I was wondering how to configure docfx.json to get DocFx to document code in other projects within the solution.
In docfx.json, there is an array of metadata. The example metadata has a src object with files and exclude properties.
To point to another project in your solution, add a cwd property to metadata and change folders (i.e. "../Another.Project").
{
"metadata": [
{
"src": [
{
"files": [ "**/*.csproj" ],
"exclude": [ "**/bin/**", "**/obj/**", "_site/**" ],
"cwd": "../Another.Project"
}
],
"dest": "obj/api"
}
],
"build": ...
}
This worked for me.
directory structure
+---ClassLibrary
| \---ClassLibrary.csproj
\---DocFxProject
\---docfx.json
docfx.json contents
cwd and src are synonyms for the same property
{
"metadata":
[
{
"src":
[
{
"files": [ "**/ClassLibrary.csproj" ],
"src": "..",
"exclude": [ "**/obj/**", "**/bin/**" ]
}
],
"dest": "obj/api"
}
],
"build": { ... }
}

Resources