-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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(v2): fix Jest tests on Windows #3540
Conversation
- add the posixPath in writeRedirectsFiles.ts
Deploy preview for docusaurus-2 ready! Built without sensitive environment variables with commit e311d53 |
@lex111 I don't think it's a good idea because this would lead to master failing on windows CI and all created PRs after the merge would also fail on windows and let contributors think they did something wrong. Also we are not sure yet how easy it is to fix all the windows tests |
However we should be able to easily track progress in this PR. maybe @skr571999 you can enable windows tests here so that we'll see this PR failing with the number of failing tests decreasing as your work progress? |
Yeah ok, @slorber
|
add posixPath in test and index
- add the window test configuration in nodejs-windows.yml
Hi, @slorber Any idea why it is it failing the
|
Hi @skr571999 No idea sorry 😅 maybe try to revert some of the changes until it passes? |
@@ -96,7 +97,7 @@ export default function pluginContentPages( | |||
|
|||
function toMetadata(relativeSource: string): Metadata { | |||
const source = path.join(pagesDir, relativeSource); | |||
const aliasedSourcePath = aliasedSitePath(source, siteDir); | |||
const aliasedSourcePath = posixPath(aliasedSitePath(source, siteDir)); |
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.
I guess it's why CI build fails, because it's the only non-test code change related to pages?
Getting But it is running fine on my machine My Machine
Not getting How to check on my local system that it is fine or not. Any idea how i can test on my system locally getting the same response as on Github Actions |
Thanks for reporting @skr571999 , don't know why it only works on your computer but not CI. Looks to me there are quite a few snapshot errors due to snapshots here: https://github.com/facebook/docusaurus/pull/3540/checks?check_run_id=1229879405 As you modify both the tests and the implementation at the same time, it's hard to tell if it can't lead to regressions. |
* Revove replace the starting "../" with "". | ||
* E.g: ../package/doc -> package/doc | ||
*/ | ||
function cleanPath(filePath) { |
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.
Before adding the cleanPath
Test Case Result
the above test cases are failing because of the extra ../
After Adding the cleanPath
Test Case Result
so, basically cleanPath
is just to remove the extra ../
from the path if it exists
Also one more thing all the 4 Test case are passing Completely fine in My Local system even without cleanPath
.
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.
But why are the tests failing due to the extra ../
in the first place? The goal is not only to make the tests pass, also to understand why the solution solves the problem. Where does this extra ../
come from and why only on Windows?
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.
But why are the tests failing due to the extra ../ in the first place? The goal is not only to make the tests pass, also to understand why the solution solves the problem.
Yeah right, I will look and update.
Where does this extra ../ come from and why only on Windows?
the extra ../
is not coming in my local System it is here only 😔.
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.
Hi @slorber
I tried finding the reason why extra ../
is coming.
so it did logging the process.cwd()
then i found the response different in my local system and different in Github CI
testing
- On my local system
- On GitHub
due to this difference in path when we are finding the relative path in our code it is adding the extra ../
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.
oh, this is weird, thanks for letting me know
Hi @slorber I have added the comment for review(contain the description about
I have revert back the old commit, because that was also having something similar problem, so i thought to try this one and look if it is happening here or not. Can u have a look and suggest what I can do because I am not able to test the changes Locally as they are passed locally and are failing here 😂
|
Hi, As I don't even have windows right now it's hard for me to review this PR. Maybe we should put this PR in stand-by until I have Windows and can provide more help? |
closed in favor of #3959 the new pr is based on your initial commits so you'll be credited for your work |
fixed in #3959 |
Motivation
I want to fix the Test Cases for Windows OS.
Have you read the Contributing Guidelines on pull requests?
Yes.
Test Plan
I have run test on
yarn test
,yarn start
,yarn start:v1
,yarn prettier && yarn lint
yarn test
,yarn start
,yarn start:v1
,yarn prettier && yarn lint
Related PRs
#3481
TODOs - packages to be fixed
nodejs-windows.yml