Skip to content

Commit c867aae

Browse files
authored
fix: unit test execution (#20)
* refactor: Update package.json structure and remove test runner script Signed-off-by: GitHub <noreply@github.com> * Refactor C# Cognitive Complexity Analyzer and Update Tests - Improved function name retrieval logic in CSharpCognitiveComplexityAnalyzer to handle special function types more efficiently. - Enhanced visit method to skip nested function declarations, preventing double-counting in complexity calculations. - Updated unit tests for complexity analyzer factory and C# language analysis to use 'suite' and 'test' instead of 'describe' and 'it'. - Added comprehensive tests for various C# constructs, including control flow statements, exception handling, and logical operators. - Introduced debug script for analyzing complexity calculations in C# functions. - Created a test suite index file to streamline test execution and loading. Signed-off-by: GitHub <noreply@github.com> * feat: Replace inline Xvfb command with dedicated start script for headless testing Signed-off-by: GitHub <noreply@github.com> * refactor: Remove debug script for complexity calculation Signed-off-by: GitHub <noreply@github.com> --------- Signed-off-by: GitHub <noreply@github.com>
1 parent 35cffaf commit c867aae

File tree

13 files changed

+3818
-3984
lines changed

13 files changed

+3818
-3984
lines changed

.devcontainer/devcontainer.json

Lines changed: 51 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,52 @@
11
{
2-
"name": "VSCode Extension Development",
3-
"image": "mcr.microsoft.com/vscode/devcontainers/typescript-node:22-bullseye",
4-
5-
// Configure tool-specific properties.
6-
"customizations": {
7-
// Configure properties specific to VS Code.
8-
"vscode": {
9-
// Add the IDs of extensions you want installed when the container is created.
10-
"extensions": [
11-
"ms-vscode.vscode-typescript-next",
12-
"ms-vscode.extension-test-runner",
13-
"ms-vscode.vscode-extension-samples",
14-
"ms-vscode.vscode-json"
15-
],
16-
17-
// Set *default* container specific settings.json values on container create.
18-
"settings": {
19-
"typescript.tsc.autoDetect": "off",
20-
"files.exclude": {
21-
"out": false
22-
},
23-
"search.exclude": {
24-
"out": true
25-
}
26-
}
27-
}
28-
},
29-
30-
// Features to add to the dev container. More info: https://containers.dev/features.
31-
"features": {
32-
"ghcr.io/devcontainers/features/git:1": {},
33-
"ghcr.io/devcontainers/features/github-cli:1": {}
34-
},
35-
36-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
37-
// "forwardPorts": [],
38-
39-
// Use 'postCreateCommand' to run commands after the container is created.
40-
"postCreateCommand": "npm install",
41-
42-
// Configure tool-specific properties.
43-
"remoteUser": "node"
44-
}
2+
"name": "VSCode Extension Development",
3+
"image": "mcr.microsoft.com/vscode/devcontainers/typescript-node:22-bullseye",
4+
5+
// Configure tool-specific properties.
6+
"customizations": {
7+
// Configure properties specific to VS Code.
8+
"vscode": {
9+
// Add the IDs of extensions you want installed when the container is created.
10+
"extensions": [
11+
"ms-vscode.vscode-typescript-next",
12+
"ms-vscode.extension-test-runner",
13+
"ms-vscode.vscode-extension-samples",
14+
"ms-vscode.vscode-json"
15+
],
16+
17+
// Set *default* container specific settings.json values on container create.
18+
"settings": {
19+
"typescript.tsc.autoDetect": "off",
20+
"files.exclude": {
21+
"out": false
22+
},
23+
"search.exclude": {
24+
"out": true
25+
}
26+
}
27+
}
28+
},
29+
30+
// Features to add to the dev container. More info: https://containers.dev/features.
31+
"features": {
32+
"ghcr.io/devcontainers/features/git:1": {},
33+
"ghcr.io/devcontainers/features/github-cli:1": {}
34+
},
35+
36+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
37+
// "forwardPorts": [],
38+
39+
// Use 'postCreateCommand' to run commands after the container is created.
40+
"postCreateCommand": "npm install && sudo apt-get update && sudo apt-get install -y libnspr4 libnss3 libxss1 libasound2 libxrandr2 libatk1.0-0 libdrm2 libxcomposite1 libxdamage1 libxfixes3 libgbm1 libatspi2.0-0 libatk-bridge2.0-0 xvfb libgtk-3-0 libgdk-pixbuf2.0-0 libcairo-gobject2 libpango-1.0-0 libglib2.0-0 libfontconfig1 libfreetype6",
41+
42+
// Start Xvfb for headless testing
43+
"postStartCommand": "bash .devcontainer/start-xvfb.sh",
44+
45+
// Set environment variables
46+
"containerEnv": {
47+
"DISPLAY": ":99"
48+
},
49+
50+
// Configure tool-specific properties.
51+
"remoteUser": "node"
52+
}

.devcontainer/start-xvfb.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
# Start Xvfb for headless testing
3+
if ! pgrep -x "Xvfb" > /dev/null; then
4+
echo "Starting Xvfb on display :99"
5+
Xvfb :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset &
6+
# Wait a moment for Xvfb to start
7+
sleep 2
8+
echo "Xvfb started successfully"
9+
else
10+
echo "Xvfb is already running"
11+
fi

.vscode-test.mjs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
import { defineConfig } from '@vscode/test-cli';
22

33
export default defineConfig({
4-
files: 'out/test/**/*.test.js',
4+
files: 'out/test/**/*.test.js',
5+
launchArgs: [
6+
'--disable-extensions',
7+
'--disable-workspace-trust',
8+
'--disable-gpu',
9+
'--no-sandbox'
10+
],
11+
// Configure environment for headless testing
12+
env: {
13+
DISPLAY: ':99',
14+
ELECTRON_DISABLE_SECURITY_WARNINGS: 'true'
15+
}
516
});

0 commit comments

Comments
 (0)