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

Bug: Path separator is different for mac and windows #225

Closed
lukeecart opened this issue Sep 4, 2021 · 0 comments · Fixed by #263
Closed

Bug: Path separator is different for mac and windows #225

lukeecart opened this issue Sep 4, 2021 · 0 comments · Fixed by #263
Assignees
Labels
bug Something isn't working

Comments

@lukeecart
Copy link
Contributor

Description: In the Codecademy Docs Content - adheres to content file structure test the split doesn't correctly split for Window users. On Mac the / is the separator whereas on windows its \\. So when running the tests on windows the test fails and doesn't split up 'nodePath' variable correctly.

Affected file: https://github.com/Codecademy/docs/blob/main/content.test.ts

Expected: line 53: const nodeName = nodePath.split('/').slice(-1)[0]; to be 'c'

Actual: line 53: const nodeName = nodePath.split('/').slice(-1)[0]; is 'C:\\Users\\USERNAME\\Documents\\codecademydocs\\content\\c'

Suggested change: instead of splitting using /, use path.sep (see https://nodejs.org/api/path.html#path_path_sep)

For example line 53 becomes:
const nodeName = nodePath.split(path.sep).slice(-1)[0]; this will fixfor windows or mac users when running test locally

@sonnynomnom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants