Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: test path incorrect #26

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "keployio",
"displayName": "Keploy",
"description": "Streamline testing with the power of Keploy, directly in your favorite IDE.",
"version": "1.0.4",
"version": "1.0.5",

"publisher": "Keploy",
"icon": "media/logo.png",
Expand Down
9 changes: 3 additions & 6 deletions scripts/utg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ export API_KEY="1234"

sourceFilePath=$1
testFilePath=$2
coverageReportPath=$3


# Add env variables to the npm test command
utgEnv=" -- --coverage --coverageReporters=text --coverageReporters=cobertura --coverageDirectory=./coverage"
# utgEnv=" -- --coverage --coverageReporters=text --coverageReporters=cobertura --coverageDirectory=./coverage"

# testCommand="npm test "+ $utgEnv

testCommand="npm test "+ $utgEnv
# echo $testCommand
# Run Keploy
# keploy gen --sourceFilePath="./src/routes/routes.js" --testFilePath="./test/routes.test.js" --testCommand=$testCommand --coverageReportPath="$coverageReportPath" --llmApiVersion="2024-02-01" --llmBaseUrl="https://keploy-open-ai-instance.openai.azure.com/openai/deployments/Keploy-gpt4o" --max-iterations="10"

keploy gen --source-file-path="$sourceFilePath" \
--test-file-path="$testFilePath" \
Expand Down
39 changes: 21 additions & 18 deletions src/SidebarProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,6 @@ export class SidebarProvider implements vscode.WebviewViewProvider {
vscode.Uri.joinPath(this._extensionUri, "out", "compiled/Config.css")
);

//if config file is already present then navigate to keploy page
const folderPath = vscode.workspace.workspaceFolders?.[0].uri.fsPath;
const configFilePath = folderPath + '/keploy.yml';
// if (existsSync(configFilePath)) {
// scriptUri = webviewView.webview.asWebviewUri(
// vscode.Uri.joinPath(this._extensionUri, "out", "compiled/KeployHome.js")
// );
// compiledCSSUri = webviewView.webview.asWebviewUri(
// vscode.Uri.joinPath(this._extensionUri, "out", "compiled/KeployHome.css")
// );
// }

webviewView.webview.html = this._getHtmlForWebview(webviewView.webview, compiledCSSUri, scriptUri);

Expand Down Expand Up @@ -237,14 +226,28 @@ export class SidebarProvider implements vscode.WebviewViewProvider {
vscode.Uri.joinPath(this._extensionUri, "out", "compiled", "UtgDocs.css")
);
} else if (data.value === "IntegrationTest") {
sveltePageJs = webviewView.webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionUri, "out", "compiled", "IntegrationTest.js")
);
sveltePageCss = webviewView.webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionUri, "out", "compiled", "IntegrationTest.css")
);

//if config file is already present then navigate to keploy page
const folderPath = vscode.workspace.workspaceFolders?.[0].uri.fsPath;
const configFilePath = folderPath + '/keploy.yml';
if (existsSync(configFilePath)) {
sveltePageJs = webviewView.webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionUri, "out", "compiled", "KeployHome.js")
);
sveltePageCss = webviewView.webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionUri, "out", "compiled", "KeployHome.css")
);
} else {
sveltePageJs = webviewView.webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionUri, "out", "compiled", "IntegrationTest.js")
);
sveltePageCss = webviewView.webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionUri, "out", "compiled", "IntegrationTest.css")
);
}

} else if (data.value === 'Config') {

sveltePageJs = webviewView.webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionUri, "out", "compiled", "Config.js")
);
Expand Down
3 changes: 1 addition & 2 deletions src/Utg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ async function Utg(context: vscode.ExtensionContext) {
vscode.window.showErrorMessage('No workspace is opened.');
return;
}
const rootDir = path.dirname(vscode.workspace.workspaceFolders[0].uri.fsPath); // Root directory of the project

const rootDir = vscode.workspace.workspaceFolders[0].uri.fsPath; // Root directory of the project
const testDir = path.join(rootDir, 'test');
const testFilePath = path.join(testDir, path.basename(sourceFilePath).replace('.js', '.test.js'));
if (!fs.existsSync(testFilePath)) {
Expand Down
4 changes: 1 addition & 3 deletions webviews/components/UtgDocs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</div>

<div class="step">
<span class="step-number">3)</span> Use the command palette by
<span class="step-number">3)</span> Or, Use the command palette by
right-clicking.
<img src={screenshot2} alt="Command palette" class="screenshot" />
</div>
Expand All @@ -41,8 +41,6 @@
</div>
</div>
</div>

<!-- Back Button -->
<button class="back-button" on:click={navigateToConfig}>
Back
</button>
Expand Down
Loading