@iamsergio/qttest-utils 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CONTRIBUTING.md CHANGED
@@ -26,10 +26,9 @@ cargo install git-cliff
26
26
  ## Releasing
27
27
 
28
28
  (Replace 1.0.0 with actual version used)
29
-
30
- export NEW_VERSION=v1.0.0
29
+ - Get a version compatible with semver, run ` git cliff --bump | head -n 5`, replace NEW_VERSION
30
+ - export NEW_VERSION=v1.0.0
31
31
  - Make sure Github Actions CI is green
32
- - Optional: To get a version compatible with semver, run `git cliff --bump`
33
- - Increase version in package.json and package-lock.json.
32
+ - npm version $NEW_VERSION
34
33
  - git cliff --tag $NEW_VERSION > Changelog
35
34
  - git add Changelog package.json package-lock.json && git commit -m "chore: bump version" && git tag -a ${NEW_VERSION} -m "${NEW_VERSION}" && git push && git push --tags && npm publish
package/Changelog CHANGED
@@ -2,12 +2,33 @@
2
2
 
3
3
 
4
4
 
5
+ ## [2.1.0] - 2024-04-25
6
+
7
+ ### 🚀 Features
8
+
9
+ - Add targetNameForExecutable()
10
+
11
+ ### 🐛 Bug Fixes
12
+
13
+ - Ignore non-executable targets
14
+
15
+ ### ⚙️ Miscellaneous Tasks
16
+
17
+ - Coding style improvement
18
+ - Update CONTRIBUTING.md file
19
+ - Fix build on macOS
20
+ - Improve CONTRIBUTING.md
21
+
5
22
  ## [2.0.0] - 2024-04-24
6
23
 
7
24
  ### 🚀 Features
8
25
 
9
26
  - [**breaking**] Use a member to hold the output function
10
27
 
28
+ ### ⚙️ Miscellaneous Tasks
29
+
30
+ - Bump version
31
+
11
32
  ## [1.4.0] - 2024-04-24
12
33
 
13
34
  ### 🚀 Features
package/out/cmake.d.ts CHANGED
@@ -13,6 +13,7 @@ export declare class CMakeTests {
13
13
  */
14
14
  tests(): Promise<CMakeTest[] | undefined>;
15
15
  private ctestJsonToList;
16
+ targetNameForExecutable(executable: string, codemodel: any): string | undefined;
16
17
  cppFilesForExecutable(executable: string, codemodel: any): string[];
17
18
  }
18
19
  export declare class CMakeTest {
package/out/cmake.js CHANGED
@@ -72,6 +72,39 @@ class CMakeTests {
72
72
  });
73
73
  return tests;
74
74
  }
75
+ /// Returns the cmake target name for the specified executable
76
+ targetNameForExecutable(executable, codemodel) {
77
+ // simplify:
78
+ if (executable.endsWith(".exe")) {
79
+ executable = executable.substring(0, executable.length - 4);
80
+ }
81
+ let projects = codemodel["projects"];
82
+ if (!projects)
83
+ return undefined;
84
+ for (let project of projects) {
85
+ let targets = project["targets"];
86
+ if (!targets)
87
+ continue;
88
+ for (let target of targets) {
89
+ let artifacts = target["artifacts"];
90
+ if (!artifacts)
91
+ continue;
92
+ for (let artifact of artifacts) {
93
+ if (artifact.endsWith(".exe")) {
94
+ artifact = artifact.substring(0, artifact.length - 4);
95
+ }
96
+ if (artifact == executable) {
97
+ let name = target["name"];
98
+ if (name) {
99
+ // We found the target name
100
+ return name;
101
+ }
102
+ }
103
+ }
104
+ }
105
+ }
106
+ return undefined;
107
+ }
75
108
  // Returns the list of .cpp files for the specified executable
76
109
  // codemodel is the CMake codemodel JSON object
77
110
  cppFilesForExecutable(executable, codemodel) {
@@ -80,37 +113,34 @@ class CMakeTests {
80
113
  executable = executable.substring(0, executable.length - 4);
81
114
  }
82
115
  let projects = codemodel["projects"];
83
- if (!projects) {
116
+ if (!projects)
84
117
  return [];
85
- }
86
118
  for (let project of projects) {
87
119
  let targets = project["targets"];
88
- if (!targets) {
120
+ if (!targets)
89
121
  continue;
90
- }
91
122
  for (let target of targets) {
92
123
  let sourceDir = target["sourceDirectory"];
93
124
  let artifacts = target["artifacts"];
94
- if (!artifacts || !sourceDir) {
125
+ if (!artifacts || !sourceDir)
126
+ continue;
127
+ let targetType = target["type"];
128
+ if (targetType != "EXECUTABLE")
95
129
  continue;
96
- }
97
130
  for (let artifact of artifacts) {
98
131
  if (artifact.endsWith(".exe")) {
99
132
  artifact = artifact.substring(0, artifact.length - 4);
100
133
  }
101
134
  if (artifact == executable) {
102
135
  let fileGroups = target["fileGroups"];
103
- if (!fileGroups) {
136
+ if (!fileGroups)
104
137
  continue;
105
- }
106
138
  for (let fileGroup of fileGroups) {
107
- if (fileGroup["language"] != "CXX" || fileGroup["isGenerated"]) {
139
+ if (fileGroup["language"] != "CXX" || fileGroup["isGenerated"])
108
140
  continue;
109
- }
110
141
  let sources = fileGroup["sources"];
111
- if (!sources) {
142
+ if (!sources)
112
143
  continue;
113
- }
114
144
  let cppFiles = [];
115
145
  for (let source of sources) {
116
146
  if (!source.endsWith("mocs_compilation.cpp")) {
package/out/test.js CHANGED
@@ -127,6 +127,11 @@ function runCodeModelTests(codeModelFile) {
127
127
  console.error("Expected " + expected + ", got " + got);
128
128
  process.exit(1);
129
129
  }
130
+ let targetName = cmake.targetNameForExecutable("/vscode-qttest/test/qt_test/build-dev/test1", codemodelJson);
131
+ if (targetName != "test1") {
132
+ console.error("Expected test1, got " + targetName);
133
+ process.exit(1);
134
+ }
130
135
  });
131
136
  }
132
137
  runTests("test/qt_test/build-dev/");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iamsergio/qttest-utils",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "API for listing QtTest executables from a build directory and which individual test slots each executable contains. Useful for a Text Explorer VSCode extension.",
5
5
  "repository": {
6
6
  "type": "git",