From 4825edd4c7347eb565b6fa9c66f90260fb885aa4 Mon Sep 17 00:00:00 2001
From: PauliusKu
Date: Thu, 23 Jan 2025 17:56:38 +0200
Subject: [PATCH] test 3
---
.vscode/settings.json | 2 ++
src/stability-test/suite/extension.test.ts | 25 ++++++++++++++++------
2 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/.vscode/settings.json b/.vscode/settings.json
index d16a58a..5c3e53c 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -9,4 +9,6 @@
"[typescript]" : {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
+
+ "editor.formatOnSave": true
}
\ No newline at end of file
diff --git a/src/stability-test/suite/extension.test.ts b/src/stability-test/suite/extension.test.ts
index 66affcb..ba690e8 100644
--- a/src/stability-test/suite/extension.test.ts
+++ b/src/stability-test/suite/extension.test.ts
@@ -34,8 +34,20 @@ const testRunTimestamp = new Date()
.substring(0, 19);
const testRunDir = join(testResultsDir, testRunTimestamp);
+const knownFailures = getFailedTestCases(
+ join(extensionDevelopmentPath, "resources/stabilityTests")
+);
+const settingsOverride =
+ "/* formatterSettingsOverride */\n/*" +
+ readFile(
+ join(
+ extensionDevelopmentPath,
+ "resources/stabilityTests/.vscode/settings.json"
+ )
+ ) +
+ "*/\n";
-const knownFailures = getFailedTestCases(join(extensionDevelopmentPath, "resources/stabilityTests"));
+console.log(settingsOverride);
suite("Extension Test Suite", () => {
console.log("Parser initialized", stabilityTestCases);
@@ -77,15 +89,15 @@ function stabilityTest(name: string): void {
ConfigurationManager2.getInstance();
enableFormatterDecorators();
- const beforeText = getInput(name);
+ const beforeText = settingsOverride + getInput(name);
const beforeCount = countActualSymbols(beforeText);
const afterText = format(beforeText, name);
const afterCount = countActualSymbols(afterText);
if (beforeCount !== afterCount) {
const nameWithRelativePath = name.startsWith(stabilityTestDir)
- ? name.slice(stabilityTestDir.length + 1)
- : name;
+ ? name.slice(stabilityTestDir.length + 1)
+ : name;
const fileName = nameWithRelativePath.replace(/[\s\/\\:*?"<>|]+/g, "_");
@@ -268,17 +280,16 @@ function getFailedTestCases(filePath: string): string[] {
// Read the file and split lines into an array
const data = fs.readFileSync(failedFilePath, "utf8");
- const failures = data.split("\n").filter(line => line.trim() !== "");
+ const failures = data.split("\n").filter((line) => line.trim() !== "");
console.log("Known failures list has ", failures.length, "cases");
return failures;
}
-
function addFailedTestCase(filePath: string, failedCase: string): void {
const failedFilePath = path.join(filePath, "_failures.txt");
// Append the failed test case to the file with a newline
fs.appendFileSync(failedFilePath, failedCase + "\n", "utf8");
-}
\ No newline at end of file
+}