Skip to content
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

test: convert flaky tests to jest & increase timeout #1657

Merged
merged 1 commit into from
Feb 26, 2021

Conversation

lili2311
Copy link
Contributor

@lili2311 lili2311 commented Feb 23, 2021

  • Ready for review
  • Follows CONTRIBUTING rules
  • Reviewed by Snyk internal team

What does this PR do?

Convert some flaky tests to jest from tap
Increase timeout for analytics tests
Use a smaller fixture with a lockfile for a slow test test/monitor-target.spec.ts that was running on node_modules

@lili2311 lili2311 requested review from a team as code owners February 23, 2021 20:02
async function getFakeServerRequestBody(server) {
const dir = path.join(__dirname, '/acceptance', 'workspaces');
process.chdir(dir);
await cli.monitor('yarn-package');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

don't scan the root package as it triggers a super slow node_modules traversal test

throw err;
}
// give file a little time to be finished to be written
await new Promise((r) => setTimeout(r, 3000));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

wait a little for file to finish writing before reading it.

@lili2311 lili2311 self-assigned this Feb 23, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Feb 23, 2021

Messages
📖

This PR will not trigger a new version. It doesn't include any commit message with feat or fix.

Generated by 🚫 dangerJS against b748b87

test/analytics.spec.ts Outdated Show resolved Hide resolved
test/monitor-target.spec.ts Outdated Show resolved Hide resolved
@lili2311 lili2311 force-pushed the test/improve-flaky-tests branch 3 times, most recently from 2f53943 to af14787 Compare February 23, 2021 20:39
jest.config.js Outdated Show resolved Hide resolved
@lili2311 lili2311 force-pushed the test/improve-flaky-tests branch 2 times, most recently from 293511b to 143fab7 Compare February 24, 2021 17:08
.toLowerCase()
.indexOf('windows') === 0;
describe('test --json-file-output ', () => {
const noVulnsProjectPath = join(__dirname, '/acceptance', 'workspaces', 'no-vulns');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

use a project with no vulns so we are not trying to traverse node_modules for this test which is slow

@lili2311 lili2311 force-pushed the test/improve-flaky-tests branch 2 times, most recently from 9bf1fa0 to 2c5e30c Compare February 24, 2021 17:20
@lili2311 lili2311 force-pushed the test/improve-flaky-tests branch 8 times, most recently from 8d60af3 to a4dcbad Compare February 25, 2021 14:18
Copy link
Member

@anthogez anthogez left a comment

Choose a reason for hiding this comment

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

Looks good - as this is a refactor, I would recommend refactor instead of test

@lili2311 lili2311 merged commit ae59125 into master Feb 26, 2021
@lili2311 lili2311 deleted the test/improve-flaky-tests branch February 26, 2021 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants