Skip to content

Commit

Permalink
fix: wrong file detection in nodejs (#55)
Browse files Browse the repository at this point in the history
* fix: wrong file detection in express

Signed-off-by: shivamsouravjha <[email protected]>

* fix:indent

Signed-off-by: shivamsouravjha <[email protected]>

---------

Signed-off-by: shivamsouravjha <[email protected]>
  • Loading branch information
shivamsouravjha authored Sep 18, 2024
1 parent c32f0d6 commit 0cd6724
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@ First Release for Vs Code Extension.
## [1.0.11]

- Maintaining user session

## [1.0.12]

- Fixing wrong file test generation in express mongoose
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.11",
"version": "1.0.12",
"publisher": "Keploy",
"icon": "media/logo.png",
"pricing": "Free",
Expand Down
3 changes: 1 addition & 2 deletions src/Utg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ async function Utg(context: vscode.ExtensionContext) {

const rootDir = vscode.workspace.workspaceFolders[0].uri.fsPath;

await ensureTestFileExists(sourceFilePath , rootDir);

const extension = path.extname(sourceFilePath);
let testFilePath: string;
Expand All @@ -61,7 +60,7 @@ async function Utg(context: vscode.ExtensionContext) {
let testFileContent:string;

if (extension === '.js' || extension === '.ts') {
testFilePath = sourceFilePath.replace(extension, `.test${extension}`);
testFilePath = path.join(path.join(rootDir, 'test'), path.basename(sourceFilePath).replace(extension, `.test${extension}`));
if (!fs.existsSync(testFilePath)) {
vscode.window.showInformationMessage("Test doesn't exist", testFilePath);
fs.writeFileSync(testFilePath, `// Test file for ${testFilePath}`);
Expand Down

0 comments on commit 0cd6724

Please sign in to comment.