Skip to content

Fix line parsing in e2e test parser #757

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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