Skip to content

Conversation

@sampart
Copy link
Contributor

@sampart sampart commented Jun 23, 2020

The full test output is long, so here's an example of a single test before and after.

Before:

$ npm test

> codeql@0.0.0 test /Users/sam/code/codeql-action
> ava src/fingerprints.test.ts --serial


⠸ hash
⠼ hash

  1 passed::debug::Ignoring location URI "/src/foo/bar.js' as it is outside of the src root
::debug::Ignoring location URI "https:///Users/sam/code/codeql-action/lib/fingerprints.test.js' as the scheme is not recognised
::debug::Ignoring location URI "ftp:///Users/sam/code/codeql-action/lib/fingerprints.test.js' as the scheme is not recognised
::debug::Ignoring location as uri "1" is invalid
::debug::Ignoring location as uri "undefined" is invalid
::debug::Unable to compute fingerprint for non-existent file: /Users/sam/code/codeql-action/lib/fingerprints.test.js2

  4 tests passed

After:

$ npm test

> codeql@0.0.0 test /Users/sam/code/codeql-action
> ava src/fingerprints.test.ts --serial



  4 tests passed

There's still a fair bit of noise that isn't caught by this (e.g. output from system calls), and the output could do with more cleaning generally, but this is a start, and provides a framework for further improvements.

Thanks to @alexrford for pairing with me on much of this.

Merge / deployment checklist

  • Run test builds as necessary. Can be on this repository or elsewhere as needed in order to test the change - please include links to tests in other repos!
    • CodeQL using init/analyze actions
    • 3rd party tool using upload action
  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.

@sampart sampart requested a review from robertbrignull June 23, 2020 09:00
@sampart sampart mentioned this pull request Jun 23, 2020
4 tasks
// Core library will directly call process.stdout.write for commands
// We don't want debug output to be included in tests
if (typeof str === "string") {
str = str.replace(/::(info|debug|warning).*/, '');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't assume that this is at the start of the line, because it gets interleaved with output from Ava, so you might see lines like:

6 passed::debug::{...}

@robertbrignull
Copy link
Contributor

I think you are missing calls to silenceDebugOutput(test) in util.test.ts and setup-tools.test.ts

@sampart
Copy link
Contributor Author

sampart commented Jun 23, 2020

Good spot, thanks. Added in a30a5ba

@robertbrignull
Copy link
Contributor

I spent quite a while investigating this to see if I could learn any more or improve things. I ended up opening #79 because that seemed easier. Let me know what you think.

@sampart
Copy link
Contributor Author

sampart commented Jun 24, 2020

Superseded by #79.

@sampart sampart closed this Jun 24, 2020
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.

3 participants