Skip to content

Commit

Permalink
Debug failing swift-testing test
Browse files Browse the repository at this point in the history
  • Loading branch information
plemarquand committed Feb 13, 2025
1 parent 737bb7c commit 362b63e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM swiftlang/swift:nightly-6.1-jammy
FROM swift:6.0-jammy

RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
&& apt-get -q update \
Expand Down
18 changes: 18 additions & 0 deletions assets/test/defaultPackage/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@
"args": [],
"cwd": "${workspaceFolder:defaultPackage}",
"preLaunchTask": "swift: Build Release package1"
},
{
"type": "swift",
"request": "launch",
"args": [],
"cwd": "${workspaceFolder:defaultPackage}",
"name": "Debug PackageExe",
"program": "${workspaceFolder:defaultPackage}/.build/debug/PackageExe",
"preLaunchTask": "swift: Build Debug PackageExe"
},
{
"type": "swift",
"request": "launch",
"args": [],
"cwd": "${workspaceFolder:defaultPackage}",
"name": "Release PackageExe",
"program": "${workspaceFolder:defaultPackage}/.build/release/PackageExe",
"preLaunchTask": "swift: Build Release PackageExe"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ import Testing
#if swift(>=6.0)
@Test func topLevelTestPassing() {
print("A print statement in a test.")
#if !TEST_ARGUMENT_SET_VIA_TEST_BUILD_ARGUMENTS_SETTING
Issue.record("Expected TEST_ARGUMENT_SET_VIA_TEST_BUILD_ARGUMENTS_SETTING to be set at compilation")
#endif
// #if !TEST_ARGUMENT_SET_VIA_TEST_BUILD_ARGUMENTS_SETTING
// Issue.record("Expected TEST_ARGUMENT_SET_VIA_TEST_BUILD_ARGUMENTS_SETTING to be set at compilation")
// #endif
}

@Test func topLevelTestFailing() {
Expand Down
9 changes: 8 additions & 1 deletion src/TestExplorer/TestParsers/SwiftTestingOutputParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ export class SwiftTestingOutputParser {
public testRunStarted: () => void,
public addParameterizedTestCase: (testClass: TestClass, parentIndex: number) => void,
public onAttachment: (testIndex: number, path: string) => void
) {}
) {
// eslint-disable-next-line no-console
console.log(">>> Swift Testing Output Parser created...");
}

/**
* Watches for test events on the named pipe at the supplied path.
Expand All @@ -193,6 +196,8 @@ export class SwiftTestingOutputParser {
runState: ITestRunState,
pipeReader?: INamedPipeReader
): Promise<void> {
// eslint-disable-next-line no-console
console.log(">>> Swift Testing Output Parser watching:", path);
this.path = path;

// Creates a reader based on the platform unless being provided in a test context.
Expand Down Expand Up @@ -347,6 +352,8 @@ export class SwiftTestingOutputParser {
}

private parse(item: SwiftTestEvent, runState: ITestRunState) {
// eslint-disable-next-line no-console
console.log(">>> Swift Testing Event:", JSON.stringify(item, null, 2));
if (
item.kind === "test" &&
item.payload.kind === "function" &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ suite("Test Explorer Suite", function () {
}
});

test(`Runs passing test (${runProfile})`, async function () {
test.only(`Runs passing test (${runProfile})`, async function () {
const testRun = await runTest(
testExplorer,
runProfile,
Expand Down

0 comments on commit 362b63e

Please sign in to comment.