-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: fix some unit tests errors on win #30157
base: develop
Are you sure you want to change the base?
Conversation
|
updating progress: 370 passing (24s)
1 pending
5 failing
1) FileDataSource
#getFilesByGlob
integration
#getFilesByGlob
does not replace working directory in glob pattern if it is not leading:
Error: C:\Users\86159\AppData\Local\Temp\cy-projects\globby-test-bed\cypress\C:\Users\86159\AppData\Local\Temp\cy-projects\globby-test-bed contains invalid WIN32 path characters.
at Object.mkdirs (node_modules\fs-extra\lib\mkdirs\mkdirs.js:18:22)
at D:\opensource\cypress\node_modules\universalify\index.js:13:12
at new Promise (<anonymous>)
at Object.mkdirs (D:\opensource\cypress\node_modules\universalify\index.js:7:14)
at Context.<anonymous> (test\unit\sources\FileDataSource.spec.ts:72:20)
at processImmediate (node:internal/timers:476:21)
2) FileDataSource
#getFilesByGlob
unit
matches absolute patterns without including working dir in pattern:
AssertionError: expected matchGlobs to have been called with arguments [ 'cypress/e2e/**.cy.js' ], {
onlyFiles: true,
absolute: true,
ignore: [ '**/node_modules/**' ],
cwd: '/my/project'
}
[ '/my/project/cypress/e2e/**.cy.js' ] [ 'cypress/e2e/**.cy.js' ]
{
onlyFiles: true,
absolute: true,
ignore: [ '**/node_modules/**' ],
cwd: '/my/project',
ignore: [ '**/node_modules/**' ]
}
at Context.<anonymous> (test\unit\sources\FileDataSource.spec.ts:254:45)
3) FileDataSource
#getFilesByGlob
unit
matches absolute patterns that include a copy of the working dir structure:
AssertionError: expected matchGlobs to have been called with arguments [ 'cypress/my/project/e2e/**.cy.js' ], {
onlyFiles: true,
absolute: true,
ignore: [ '**/node_modules/**' ],
cwd: '/my/project'
}
[ '/my/project/cypress/my/project/e2e/**.cy.js' ] [ 'cypress/my/project/e2e/**.cy.js' ]
{
onlyFiles: true,
absolute: true,
ignore: [ '**/node_modules/**' ],
cwd: '/my/project',
ignore: [ '**/node_modules/**' ]
}
at Context.<anonymous> (test\unit\sources\FileDataSource.spec.ts:267:45)
4) GitDataSource
Git hashes
detects change in hashes after a commit:
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (D:\opensource\cypress\packages\data-context\test\unit\sources\GitDataSource.spec.ts)
at listOnTimeout (node:internal/timers:569:17)
at processTimers (node:internal/timers:512:7)
5) ProjectDataSource
#defaultSpecFilename
yields correct filename from specpattern if there are existing specs:
AssertionError [ERR_ASSERTION]: Cannot get config file contents without a config manager
at ProjectLifecycleManager.getConfigFileContents (src\data\ProjectLifecycleManager.ts:620:11)
at ProjectDataSource.specPatternsByTestingType (src\sources\ProjectDataSource.ts:286:56)
at ProjectDataSource.matchesSpecPattern (src\sources\ProjectDataSource.ts:519:82)
at ProjectDataSource.defaultSpecFileName (src\sources\ProjectDataSource.ts:486:24)
at async Context.<anonymous> (test\unit\sources\ProjectDataSource.spec.ts:818:35)
error Command failed with exit code 5.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
Only two errors now, it seems caused by my env: 367 passing (14s)
1 pending
2 failing
1) GitDataSource
"before each" hook for "gets correct status for files on win32":
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (D:\opensource\cypress\packages\data-context\test\unit\sources\GitDataSource.spec.ts)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
2) ProjectDataSource
#defaultSpecFilename
yields correct filename from specpattern if there are existing specs:
AssertionError [ERR_ASSERTION]: Cannot get config file contents without a config manager
at ProjectLifecycleManager.getConfigFileContents (src\data\ProjectLifecycleManager.ts:620:11)
at ProjectDataSource.specPatternsByTestingType (src\sources\ProjectDataSource.ts:286:56)
at ProjectDataSource.matchesSpecPattern (src\sources\ProjectDataSource.ts:519:82)
at ProjectDataSource.defaultSpecFileName (src\sources\ProjectDataSource.ts:486:24)
at async Context.<anonymous> (test\unit\sources\ProjectDataSource.spec.ts:818:35)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
@gweesin Could you add a changelog entry for this fix? There are instructions here: https://github.com/cypress-io/cypress/blob/develop/guides/writing-the-cypress-changelog.md |
`Error: Expected line number 2 to include "## x.x.x"`
@gweesin There's still some errors in the tests, you can check CircleCI logs for full errors. |
Additional details
There are two primary differences in path and line break conventions across different operating systems:
1. Path separators: Paths are typically separated by a forward slash (/) on Unix-like systems (e.g., Linux, macOS) and a backslash () on Windows.
2. Line terminators: Line breaks are often represented by a carriage return and line feed sequence (\r\n) on Windows, while a single line feed character (\n) is used on Unix-like systems.
Steps to test
run
yarn workspace @packages/data-context test
How has the user experience changed?
After identifying and correcting 25 errors in my previous work, I have successfully reduced the number to 14. I am currently diligently working to eliminate the remaining issues.
PR Tasks
cypress-documentation
?type definitions
?