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

fix: check for read & write permissions on README file #59

Merged
merged 3 commits into from Dec 3, 2021
Merged

fix: check for read & write permissions on README file #59

merged 3 commits into from Dec 3, 2021

Conversation

micalevisk
Copy link
Contributor

Closes #58


For whatever reason doing:

try {
  fs.accessSync('fake-path', fs.constants.R_OK | fs.constants.W_OK)
} catch (err) {
  console.log(err instanceof Error) // always: false
}

in some spec file, err above won't be an instance of Error. This is why I've use mockImplementation on fs.accessSync method. Otherwise, it never enter on the IF statement of L19 of src/validate.ts

I didn't like that approach as it doesn't use the real fs module, and makes the test suite pretty coupled with the implementation. But didn't find another way to write that.

@sonarcloud
Copy link

sonarcloud bot commented Nov 25, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@olavoparno olavoparno merged commit adb639d into the-bugging:develop Dec 3, 2021
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.

bug: validation step ignore file permissions
2 participants