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

Following Contributing docs fails locally #2377

Closed
elierotenberg opened this issue Oct 1, 2020 · 2 comments · Fixed by #2378
Closed

Following Contributing docs fails locally #2377

elierotenberg opened this issue Oct 1, 2020 · 2 comments · Fixed by #2378
Assignees
Labels
type: docs Improvement to the documentation for an API.

Comments

@elierotenberg
Copy link
Contributor

elierotenberg commented Oct 1, 2020

Environment details

  • OS: Windows 10
  • Node.js version: 13.10.1
  • npm version: 6.13.7
  • googleapis version: 60.0.1

Steps to reproduce

  1. Checkout repository
  2. npm run samples-test, npm run system-test (without prior npm run fix).

Working on a PR, I checkout out the repo and followed the CONTRIBUTING instructions.

I ran across several issues, similar to those encountered in nodejs-googleapis-common.

Not Windows-related

The following dependencies were already in the samples package.json but caused npm run samples test to fail:

  • @google-cloud/local-auth,
  • nconf,
  • express.

This is because the samples subpackage isn't installed. It is installed as a side effect of npm run prelint which may hide the problem, e.g. if prelint has run at least once.

Running npm install from the samples subdir solved it.

Windows related

The following error is raised when running npm run samples-test on Windows:

  1) Auth samples
       should support JWT:
     Error: EPERM: operation not permitted, symlink
         'XXXXXX\google-api-nodejs-client\test\fixtures\service.json' ->
         'XXXXXX\google-api-nodejs-client\samples\jwt.keys.json'

This is likely because fs.symlinkSync doesn't work properly on Windows on files (altough it works with directories using junction type) or requires privilege elevation.

As a workaround, copying the file instead of symlinking it solved it.

Authentication related

The problems described in this issue also apply.

elierotenberg added a commit to elierotenberg/google-api-nodejs-client that referenced this issue Oct 1, 2020
* Always `npm install` samples/package.json before running sample tests
* Copy, rather than symlink, in `test.samples.auth`

Partially fixes googleapis#2377.
@bcoe
Copy link
Contributor

bcoe commented Oct 1, 2020

@elierotenberg this answers my question 😄

Is there a tracking issue on Node.js (or is this a known limitation of Windows?). I'm on the Node.js tooling team, and would love to fix odd things like this.

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Oct 2, 2020
@elierotenberg
Copy link
Contributor Author

I couldn't find an issue on Node.js, because I believe it "works as intented" on Windows: symlinks in "dir" or "file" mode require elevated privileges, "junction" doesn't but only works on directories.
See also:

Another option would be to symlink (using junction on Windows, type being ignored on non-Windows hosts) the parent folder and use the original filename, would that be better?

@JustinBeckwith JustinBeckwith added the type: docs Improvement to the documentation for an API. label Oct 2, 2020
@yoshi-automation yoshi-automation removed the triage me I really want to be triaged. label Oct 2, 2020
JustinBeckwith added a commit that referenced this issue Oct 28, 2020
…ests (#2378)

* Always `npm install` samples/package.json before running sample tests
* Copy, rather than symlink, in `test.samples.auth`

Partially fixes #2377.

Co-authored-by: sofisl <[email protected]>
Co-authored-by: Justin Beckwith <[email protected]>
@JustinBeckwith JustinBeckwith self-assigned this Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: docs Improvement to the documentation for an API.
Projects
None yet
4 participants