Update ESLint configuration, package.json, and README; improve formatting and versioning consistency. Adjust TypeScript configuration to disallow importing extensions and refine test scripts for better readability.

This commit is contained in:
2025-11-23 01:15:28 -05:00
parent 3deadc6e75
commit f007573ade
15 changed files with 218 additions and 164 deletions

View File

@@ -13,4 +13,4 @@ if [ ! -d "${distDirectory}" ]; then
fi
echo "Preparing [package.json] to [${distDirectory}]"
jq '{name, version, author, type, types, exports, files, publishConfig}' "${packageJsonPath}" > "${distDirectory}/package.json"
jq '{name, version, author, type, main, module, types, exports, files, publishConfig}' "${packageJsonPath}" > "${distDirectory}/package.json"

View File

@@ -16,10 +16,13 @@ async function convertTAPToTeamCity() {
return;
}
const proc = Bun.spawn(["bun", "test", "--reporter=tap", ...process.argv.slice(2)], {
stdout: "pipe",
stderr: "pipe",
});
const proc = Bun.spawn(
["bun", "test", "--reporter=tap", ...process.argv.slice(2)],
{
stdout: "pipe",
stderr: "pipe",
},
);
const decoder = new TextDecoder();
let currentSuite = "Tests";
@@ -42,11 +45,15 @@ async function convertTAPToTeamCity() {
// ok 1 - test description
// not ok 2 - failed test
// # describe block
if (line.startsWith("# ")) {
// Suite/describe block
const suiteName = line.substring(2).trim();
if (suiteName && !suiteName.startsWith("tests") && !suiteName.startsWith("pass")) {
if (
suiteName &&
!suiteName.startsWith("tests") &&
!suiteName.startsWith("pass")
) {
if (testCount > 0) {
TeamcityReporter.reportSuiteEnd(currentSuite);
}
@@ -67,12 +74,11 @@ async function convertTAPToTeamCity() {
if (not) {
// Test failed
TeamcityReporter.reportTestFailed(
fullName,
"Test failed",
line,
{ comparisonFailure: false, expected: "", actual: "" }
);
TeamcityReporter.reportTestFailed(fullName, "Test failed", line, {
comparisonFailure: false,
expected: "",
actual: "",
});
}
TeamcityReporter.reportTestEnd(fullName);
@@ -96,4 +102,3 @@ convertTAPToTeamCity().catch((error) => {
console.error("Error:", error);
process.exit(1);
});

View File

@@ -6,6 +6,7 @@ const isTeamCity = process.env.TEAMCITY_VERSION !== undefined;
// Strip ANSI color codes
function stripAnsi(str: string): string {
// eslint-disable-next-line no-control-regex
return str.replace(/\x1b\[[0-9;]*m/g, "");
}
@@ -32,7 +33,7 @@ async function runTests() {
});
const suiteStack: string[] = [];
// Read stdout as text
const output = await new Response(proc.stdout).text();
const lines = output.split("\n");
@@ -46,8 +47,11 @@ async function runTests() {
// Check for test suite/describe blocks (files ending with .test.ts)
if (line.match(/tests\/.+\.test\.ts:$/)) {
const fileName = line.replace(":", "").replace("tests/", "").replace(".test.ts", "");
const fileName = line
.replace(":", "")
.replace("tests/", "")
.replace(".test.ts", "");
// End previous suite if exists
while (suiteStack.length > 0) {
const oldSuite = suiteStack.pop();
@@ -73,12 +77,11 @@ async function runTests() {
if (failMatch) {
const testName = failMatch[1].trim();
TeamcityReporter.reportTestStart(testName);
TeamcityReporter.reportTestFailed(
testName,
"Test failed",
line,
{ comparisonFailure: false, expected: "", actual: "" }
);
TeamcityReporter.reportTestFailed(testName, "Test failed", line, {
comparisonFailure: false,
expected: "",
actual: "",
});
TeamcityReporter.reportTestEnd(testName);
}
}