Skip to content

nf-test folder specification #127

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

Merged
merged 2 commits into from
May 13, 2025
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as fs from "fs";
import generateTest from "./generateTest";
import generateValidation from "./generateValidation";
import { appendToFile } from "./utils";
import * as path from "path";

async function createTest(filePath: string, token: string): Promise<boolean> {
return vscode.window.withProgress(
Expand All @@ -15,7 +16,13 @@ async function createTest(filePath: string, token: string): Promise<boolean> {
try {
progress.report({ message: "Reading file contents" });
const content = fs.readFileSync(filePath, "utf8");
const newFilePath = filePath.replace(".nf", ".nf.test");
const dir = path.dirname(filePath);
const testDir = path.join(dir, "tests");
if (!fs.existsSync(testDir)) {
fs.mkdirSync(testDir);
}
const baseName = path.basename(filePath);
const newFilePath = path.join(testDir, baseName.replace(".nf", ".nf.test"));
const uri = vscode.Uri.file(newFilePath);

// Create new file
Expand Down