Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,22 @@ jobs:
git commit -m "Update CHANGELOG.md after release [skip ci]"
git push

- name: Publish coverage report to Code Climate
uses: paambaati/codeclimate-action@f429536ee076d758a24705203199548125a28ca7 # v9.0.0
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
with:
debug: true
coverageLocations: coverage/lcov.info:lcov

package:
name: Package
runs-on: [ubuntu-latest]
needs: build
strategy:
fail-fast: true
matrix:
target:
target:
- win32-x64
- win32-arm64
- linux-x64
Expand Down Expand Up @@ -146,8 +154,8 @@ jobs:
- name: Download packages
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: vsix-package-*
pattern: vsix-package-*

- name: Attach packages
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ dist
test-workspace/*
!test-workspace/.vscode
tools
coverage
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ scripts
tools/**/version.txt
tools/**/target.txt
tools/**/sha256.txt
coverage
32 changes: 32 additions & 0 deletions __mocks__/vscode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright 2025 Arm Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const { URI } = require('vscode-uri');

module.exports = {
Uri: URI,
workspace: {
getConfiguration: jest.fn(() => ({
get: jest.fn(),
})),
},
extensions: {
getExtension: jest.fn(),
},
commands: {
executeCommand: jest.fn(),
}
};
5 changes: 4 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ import tseslint from 'typescript-eslint';
export default [
{
ignores: [
"__mocks__/**/*",
"coverage/**/*",
"dist",
"scripts",
"**/*.d.ts",
"jest.config.js",
"*.config.{ts,js}",
"*.setup.{ts,js}",
"node_modules",
"webpack.config.js"
]
Expand Down
7 changes: 0 additions & 7 deletions jest.config.js

This file was deleted.

41 changes: 41 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Copyright 2025 Arm Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import type { Config } from 'jest';

const config: Config = {
testEnvironment: "node",
preset: "ts-jest",
transform: {
"^.+\\.tsx?$": [
"ts-jest", {
}
],
},
setupFiles: ["<rootDir>/jest.setup.ts"],
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: [
"src/**/*.{ts,tsx}",
"!**/*.d.ts",
"!**/*.factories.{ts,tsx}",
"!src/desktop/extension.ts",
],
coverageDirectory: "./coverage",
coverageReporters: ["lcov", "text"],
};

export default config;
16 changes: 16 additions & 0 deletions jest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Copyright 2025 Arm Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@
"ts-node": "^10.9.2",
"typescript": "^5.4.5",
"typescript-eslint": "8.24.1",
"vscode-uri": "^3.1.0",
"webpack": "^5.98.0",
"webpack-cli": "^6.0.1",
"yargs": "^17.7.2"
Expand Down
60 changes: 60 additions & 0 deletions src/desktop/builtin-tool-path.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* Copyright 2025 Arm Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import * as vscode from 'vscode';
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import { BuiltinToolPath } from './builtin-tool-path';

const TOOL_EXTENSION = os.platform() === 'win32' ? '.exe' : '';

describe('BuiltinToolPath', () => {

let testFolder: string;

beforeEach(() => {
testFolder = fs.mkdtempSync(path.join(os.tmpdir(), 'jest-'));
(vscode.extensions.getExtension as jest.Mock).mockReturnValue({
extensionUri: vscode.Uri.file(testFolder),
});
});

afterEach(() => {
jest.clearAllMocks();
fs.rmSync(testFolder, { recursive: true, force: true });
});

it('should return the correct path for a given tool', () => {
const builtinToolPath = new BuiltinToolPath('tools/pyocd/pyocd');

fs.mkdirSync(`${testFolder}/tools/pyocd`, { recursive: true });
fs.writeFileSync(`${testFolder}/tools/pyocd/pyocd${TOOL_EXTENSION}`, '');

const expected = vscode.Uri.file(`${testFolder}/tools/pyocd/pyocd${TOOL_EXTENSION}`);
const result = builtinToolPath.getAbsolutePath();
expect(result?.fsPath).toBe(expected.fsPath);
});

it('should return undefined if tool does not exist', () => {
const builtinToolPath = new BuiltinToolPath('tools/pyocd/pyocd');

const result = builtinToolPath.getAbsolutePath();
expect(result).toBeUndefined();
});

});

5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4838,6 +4838,11 @@ v8-to-istanbul@^9.0.1:
"@types/istanbul-lib-coverage" "^2.0.1"
convert-source-map "^2.0.0"

vscode-uri@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.1.0.tgz#dd09ec5a66a38b5c3fffc774015713496d14e09c"
integrity sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ==

walker@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f"
Expand Down