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: fix vscode jest timeout #11764

Merged
merged 6 commits into from Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions .vscode/launch.json
Expand Up @@ -22,7 +22,7 @@
"args": [
"--runInBand",
"--collectCoverage=false",
"--testTimeout 100000000",
"--testTimeout=100000000",
"--runTestsByPath",
"${relativeFile}"
],
Expand All @@ -46,7 +46,7 @@
"args": [
"--runInBand",
"--collectCoverage=false",
"--testTimeout 100000000"
"--testTimeout=100000000"
],
"env": {
"NODE_ENV": "test",
Expand All @@ -73,7 +73,7 @@
"jest",
"--runInBand",
"--watchAll=false",
"--testTimeout 100000000"
"--testTimeout=100000000"
]
}
]
Expand Down
7 changes: 7 additions & 0 deletions lib/util/git/url.spec.ts
Expand Up @@ -39,6 +39,13 @@ describe('util/git/url', () => {
);
});

it('returns https url with token with included username', () => {
hostRules.find.mockReturnValueOnce({ token: 'token' });
expect(
getRemoteUrlWithToken('https://oauth2:token@foo.bar/bar/foo')
).toBe('https://oauth2:token@foo.bar/bar/foo');
});

viceice marked this conversation as resolved.
Show resolved Hide resolved
it('returns https url with token for non-http protocols', () => {
hostRules.find.mockReturnValueOnce({ token: 'token' });
expect(getRemoteUrlWithToken('ssh://foo.bar/')).toBe(
Expand Down
6 changes: 5 additions & 1 deletion lib/util/git/url.ts
Expand Up @@ -5,7 +5,11 @@ import * as hostRules from '../host-rules';
export function getHttpUrl(url: string, token?: string): string {
const parsedUrl = GitUrlParse(url);

parsedUrl.token = token;
if (parsedUrl.user.includes(token)) {
parsedUrl.token = parsedUrl.user;
} else {
parsedUrl.token = token;
}
viceice marked this conversation as resolved.
Show resolved Hide resolved

const protocol = /^https?$/.exec(parsedUrl.protocol)
? parsedUrl.protocol
Expand Down