Repository navigation
Description
Issue description
A test case is corrupting the process environment
Expected Behavior
The test case should define and validate the expected behavior. The test case should not change the environment for other tests.
Actual Behavior
The test case is misusing forEach, afterEach and changing the "platform" of the environment that persists to other tests, causing them to fail on Windows.
Steps to reproduce
- Run
npm teston Windows.
My Environment
| Dependency | Version |
|---|---|
| Operating System | Windows |
| TypeORM version | 0.3.20 |
Additional Context
In the filepathToName() test, beforeEach and afterEach is being used inside of a for loop. The for loop should be wrapping the outside of describe, as otherwise those are overwriting the platform (harming every other following test) and running the test incorrectly. This was causing the persistence > basic functionality suite to fail on Windows.
1) persistence > basic functionality
should save an entity:
EntityMetadataNotFoundError: No metadata for "Post" was found.
at DataSource.getMetadata (src\data-source\DataSource.ts:450:30)
When corrected, the test is failing. I can see that when the platform is "darwin", the backslash to forward slash conversion is not used, where the test is expecting that. I believe the test was incorrectly running all cases as "win32" when making the assertions.
I'm unsure of the desired behavior here. It seems like the code has an assumption that Windows-like paths will not be present on non-Windows platforms, and conversion is only done when running on Windows. If that is the case, then we should remove the path conversion comparison from the test case when testing "darwin".
if (process.platform == "win32") { // Only test path conversion on Windows
const otherOsRes = filepathToName(otherOs)
expect(winOsRes).to.equal(otherOsRes)
}
Relevant Database Driver(s)
- aurora-mysql
- aurora-postgres
- better-sqlite3
- cockroachdb
- cordova
- expo
- mongodb
- mysql
- nativescript
- oracle
- postgres
- react-native
- sap
- spanner
- sqlite
- sqlite-abstract
- sqljs
- sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, and I know how to start.
Activity
test: fix multi-database-basic-functionality
github-actions commentedon Sep 17, 2025
TypeORM has returned to active development after recently transitioning to new leadership (see related announcement).
As part of the new team's efforts to prioritise work on the project moving forward, it is necessary to clean up the backlog of stale issues.
🧹 This issue is being automatically closed because it has had no activity in the last 6 months.
If you believe this issue is still relevant, feel free to comment below and the maintainers may reopen it. Thank you for your contribution.