Skip to content

Capture separate logs for each lsptoolshost test suite #8529

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 3 commits into
base: main
Choose a base branch
from

Conversation

JoeRobich
Copy link
Member

No description provided.

@@ -5,6 +5,7 @@
Defines the lowest supported target framework for the extension.
Used by server download / integration tests to ensure they run when only this SDK is installed.
-->
<CheckEolTargetFramework>false</CheckEolTargetFramework>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed project loading did not like running on a .NET 10 preview while building net6.0 projects.


import * as vscode from 'vscode';
import { EOL, platform } from 'os';
import { describe, expect, test } from '@jest/globals';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separated these helpers out because they use @jest/globals and importing it isn't allowed in the test runner (index.ts).

// We have to fix up the file path because the test file was discovered in the /out/ directory.
file = file.substring(0, file.length - 2) + 'ts';
file = file.replace(/[\\/]out[\\/]/, path.sep);
file = workingDirectory[0] + file.substring(1);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So locally __dirname is returning the drive letter lowercased and the filepaths also are lowercased. Jest fails to match the paths to a test suite if I don't bring in a correct drive letter. Thankfully the working directory has the correct casing. Figure on unix-like platforms it should basically be a no-op.

@JoeRobich
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@JoeRobich
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

.map((file) => path.join(__dirname, file));

for (let file of testFiles) {
// We have to fix up the file path because the test file was discovered in the /out/ directory.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do sourcemaps still work if we do this? e.g. f5 launching integration tests is fine?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our launch targets set the TEST_FILTER_FILE so it shouldn't run this bit of code.


const targetLogDir = path.join(
path.dirname(exports.logDirectory),
`${name ?? 'unknown'}_${path.basename(exports.logDirectory)}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can remove unknown, name isn't nullable here

const workingDirectory = process.cwd();

const testFiles = (await fsExtra.readdir(__dirname))
.filter((file) => file.endsWith('.integration.test.js'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of doing this, I think you could probably simplify all this by getting the rootPath here, and then just go directly to the typescript files?


process.env.TEST_FILE_FILTER = file;

results = await runIntegrationTests(jestIntegrationTestProjectName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if this (or something above it) needs to catch errors and then move the logs - I noticed that in the 'Test Linux (.NET 9) CSharpIntegrationTests' leg, it looks like the sourceGenerator.integration.test.ts fail with an extension host crash, and there are no logs uploaded for it.

Image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current runs logs should still be in the logs folder even if they aren't moved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants