Skip to content

Commit b9811b9

Browse files
committed
Merge branch '0-0-1-preps' of https://github.com/Open-CMSIS-Pack/vscode-cmsis-debugger into 0-0-1-preps
2 parents cb61675 + dfde7f2 commit b9811b9

File tree

11 files changed

+176
-15
lines changed

11 files changed

+176
-15
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,22 @@ jobs:
8282
git commit -m "Update CHANGELOG.md after release [skip ci]"
8383
git push
8484
85+
- name: Publish coverage report to Code Climate
86+
uses: paambaati/codeclimate-action@f429536ee076d758a24705203199548125a28ca7 # v9.0.0
87+
env:
88+
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
89+
with:
90+
debug: true
91+
coverageLocations: coverage/lcov.info:lcov
92+
8593
package:
8694
name: Package
8795
runs-on: [ubuntu-latest]
8896
needs: build
8997
strategy:
9098
fail-fast: true
9199
matrix:
92-
target:
100+
target:
93101
- win32-x64
94102
- win32-arm64
95103
- linux-x64
@@ -146,8 +154,8 @@ jobs:
146154
- name: Download packages
147155
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
148156
with:
149-
pattern: vsix-package-*
150-
157+
pattern: vsix-package-*
158+
151159
- name: Attach packages
152160
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
153161
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ dist
55
test-workspace/*
66
!test-workspace/.vscode
77
tools
8+
coverage

.vscodeignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
.vscodeignore
55
*.vsix
66
DEVELOPMENT.md
7+
__mocks__/**/*
78
dist/**/*.js.map
8-
eslint.config.mjs
99
node_modules
1010
src
1111
test-workspace
1212
tsconfig.json
13-
webpack.config.js
1413
scripts
1514
tools/**/version.txt
1615
tools/**/target.txt
1716
tools/**/sha256.txt
17+
coverage
18+
*.config.{mjs,js,mts,ts}
19+
*.setup.{mjs,js,mts,ts}

__mocks__/vscode.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Copyright 2025 Arm Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
const { URI } = require('vscode-uri');
18+
19+
module.exports = {
20+
Uri: URI,
21+
workspace: {
22+
getConfiguration: jest.fn(() => ({
23+
get: jest.fn(),
24+
})),
25+
},
26+
extensions: {
27+
getExtension: jest.fn(),
28+
},
29+
commands: {
30+
executeCommand: jest.fn(),
31+
}
32+
};

eslint.config.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ import tseslint from 'typescript-eslint';
2020
export default [
2121
{
2222
ignores: [
23+
"__mocks__/**/*",
24+
"coverage/**/*",
2325
"dist",
2426
"scripts",
2527
"**/*.d.ts",
26-
"jest.config.js",
28+
"*.config.{ts,js,mjs}",
29+
"*.setup.{ts,js}",
2730
"node_modules",
28-
"webpack.config.js"
2931
]
3032
},
3133
js.configs.recommended,

jest.config.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

jest.config.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* Copyright 2025 Arm Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import type { Config } from 'jest';
18+
19+
const config: Config = {
20+
testEnvironment: "node",
21+
preset: "ts-jest",
22+
transform: {
23+
"^.+\\.tsx?$": [
24+
"ts-jest", {
25+
}
26+
],
27+
},
28+
setupFiles: ["<rootDir>/jest.setup.ts"],
29+
clearMocks: true,
30+
collectCoverage: true,
31+
collectCoverageFrom: [
32+
"src/**/*.{ts,tsx}",
33+
"!**/*.d.ts",
34+
"!**/*.factories.{ts,tsx}",
35+
"!src/desktop/extension.ts",
36+
],
37+
coverageDirectory: "./coverage",
38+
coverageReporters: ["lcov", "text"],
39+
};
40+
41+
export default config;

jest.setup.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Copyright 2025 Arm Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@
227227
"build": "webpack --mode production && yarn lint",
228228
"watch": "webpack -w",
229229
"lint": "eslint .",
230-
"test": "jest --passWithNoTests",
230+
"test": "jest",
231231
"package": "vsce package --yarn"
232232
},
233233
"vsce": {
@@ -254,6 +254,7 @@
254254
"ts-node": "^10.9.2",
255255
"typescript": "^5.4.5",
256256
"typescript-eslint": "8.24.1",
257+
"vscode-uri": "^3.1.0",
257258
"webpack": "^5.98.0",
258259
"webpack-cli": "^6.0.1",
259260
"yargs": "^17.7.2"
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* Copyright 2025 Arm Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import * as vscode from 'vscode';
18+
import * as fs from 'fs';
19+
import * as os from 'os';
20+
import * as path from 'path';
21+
import { BuiltinToolPath } from './builtin-tool-path';
22+
23+
const TOOL_EXTENSION = os.platform() === 'win32' ? '.exe' : '';
24+
25+
describe('BuiltinToolPath', () => {
26+
27+
let testFolder: string;
28+
29+
beforeEach(() => {
30+
testFolder = fs.mkdtempSync(path.join(os.tmpdir(), 'jest-'));
31+
(vscode.extensions.getExtension as jest.Mock).mockReturnValue({
32+
extensionUri: vscode.Uri.file(testFolder),
33+
});
34+
});
35+
36+
afterEach(() => {
37+
jest.clearAllMocks();
38+
fs.rmSync(testFolder, { recursive: true, force: true });
39+
});
40+
41+
it('should return the correct path for a given tool', () => {
42+
const builtinToolPath = new BuiltinToolPath('tools/pyocd/pyocd');
43+
44+
fs.mkdirSync(`${testFolder}/tools/pyocd`, { recursive: true });
45+
fs.writeFileSync(`${testFolder}/tools/pyocd/pyocd${TOOL_EXTENSION}`, '');
46+
47+
const expected = vscode.Uri.file(`${testFolder}/tools/pyocd/pyocd${TOOL_EXTENSION}`);
48+
const result = builtinToolPath.getAbsolutePath();
49+
expect(result?.fsPath).toBe(expected.fsPath);
50+
});
51+
52+
it('should return undefined if tool does not exist', () => {
53+
const builtinToolPath = new BuiltinToolPath('tools/pyocd/pyocd');
54+
55+
const result = builtinToolPath.getAbsolutePath();
56+
expect(result).toBeUndefined();
57+
});
58+
59+
});
60+

0 commit comments

Comments
 (0)