Skip to content
Closed
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
8 changes: 3 additions & 5 deletions server/src/e2e/suite/TestParser.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: MIT
// Copyright © 2025 TON Studio
import * as fs from "node:fs"
import * as os from "node:os"

// eslint-disable-next-line functional/type-declaration-immutability
export interface TestCase {
Expand All @@ -23,14 +22,13 @@ enum ParserState {
ReadingExpected = 5,
}

const LINE_ENDING: "\r\n" | "\n" = os.platform() === "win32" ? "\r\n" : "\n"
const SEPARATOR = "========================================================================"
const THIN_SEPARATOR = "------------------------------------------------------------------------"

export class TestParser {
public static parseAll(content: string): TestCase[] {
const tests: TestCase[] = []
const lines = content.trim().split(LINE_ENDING)
const lines = content.trim().split(/\r?\n/)

let state = ParserState.WaitingForTestStart
let currentTest: Partial<TestCase & {propertiesOrder: string[]}> = {
Expand Down Expand Up @@ -134,7 +132,7 @@ export class TestParser {
currentFilePath = line.slice(8).trim() // Remove "---FILE:" prefix
currentContent = ""
} else {
currentContent += line + LINE_ENDING
currentContent += line + "\n"
}
break
}
Expand All @@ -150,7 +148,7 @@ export class TestParser {
}
currentContent = ""
} else {
currentContent += line + LINE_ENDING
currentContent += line + "\n"
}
break
}
Expand Down
Loading