-
-
Notifications
You must be signed in to change notification settings - Fork 197
fix: pacote does not respect CLI's proxy configuration #3831
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
Conversation
run ci |
lib/services/pacote-service.ts
Outdated
return pacote.manifest(packageName, manifestOptions); | ||
} | ||
|
||
private async getPacoteBaseOptions(): Promise<IPacoteBaseOptions> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this method should be below the public methods
lib/services/pacote-service.ts
Outdated
public async extractPackage(packageName: string, destinationDirectory: string, options?: IPacoteExtractOptions): Promise<void> { | ||
// strip: Remove the specified number of leading path elements. Pathnames with fewer elements will be silently skipped. More info: https://github.com/npm/node-tar/blob/e89c4d37519b1c20133a9f49d5f6b85fa34c203b/README.md | ||
// C: Create an archive | ||
this.$logger.trace(`Calling pacoteService.extractPackage for packageName: '${packageName}', destinationDir: '${destinationDirectory}' and options: ${options}`); | ||
const extractOptions = { strip: 1, C: destinationDirectory }; | ||
if (options) { | ||
_.extend(extractOptions, options); | ||
} | ||
|
||
if (this.$fs.exists(packageName)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this logic is duplicated in both methods, extract it to a separate method
test/services/pacote-service.ts
Outdated
tarballSourceStream.emit("error", new Error("my error")); | ||
}); | ||
|
||
await assert.isRejected(pacoteExtractPackagePromise, "my error"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const expectedErrorMessage = "my error";
test/services/pacote-service.ts
Outdated
tarExtractDestinationStream.emit("error", new Error("my error")); | ||
}); | ||
|
||
await assert.isRejected(pacoteExtractPackagePromise, "my error"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const expectedErrorMessage = "my error";
Pacote does not respect the proxy settings set with `tns proxy set ...`. Pass the required options and add unit tests for the pacote service (use sinon instead of mocking with injector for the `pacote` and `tar` packages as the service is our wrapper for pacote).
63fd629
to
86c1557
Compare
Pacote does not respect the proxy settings set with
tns proxy set ...
. Pass the required options and add unit tests for the pacote service (use sinon instead of mocking with injector for thepacote
andtar
packages as the service is our wrapper for pacote).PR Checklist
What is the current behavior?
Unable to create project when working behind proxy.
What is the new behavior?
Project can be created when working behind proxy
Fixes #3824
NOTE: Merge after telerik/mobile-cli-lib#1131