Skip to content

Fix tsconfig.spec.ts not working on MacOS#1536

Merged
Perryvw merged 1 commit intoTypeScriptToLua:masterfrom
aabajyan:fix-macos-jest
Feb 6, 2024
Merged

Fix tsconfig.spec.ts not working on MacOS#1536
Perryvw merged 1 commit intoTypeScriptToLua:masterfrom
aabajyan:fix-macos-jest

Conversation

@aabajyan
Copy link
Contributor

@aabajyan aabajyan commented Feb 6, 2024

Closes #1535

@Perryvw
Copy link
Member

Perryvw commented Feb 6, 2024

I don't quite understand what the issue is here. What is the expected/actual on the failing tests? What does realpath change?

@aabajyan
Copy link
Contributor Author

aabajyan commented Feb 6, 2024

In MacOS tsconfig.spec.ts fails because the paths do not match. It expected /private directory which is missing.
Realpath returns the actual path so if you get realpath of /var and /var is a symlink of /private/var it will return /private/var.
I also noticed that it doesn't work on Windows now, so I will run this function on darwin only.

  expect(received).toBe(expected) // Object.is equality

    Expected: "/var/folders/l1/q852l81d1lv95zhblgdvf0gr0000gn/T/tstl-test-FXslwE/tsconfig.json"
    Received: "/private/var/folders/l1/q852l81d1lv95zhblgdvf0gr0000gn/T/tstl-test-FXslwE/tsconfig.js

const normalize = (name: string) => {
const result = normalizeSlashes(path.resolve(temp, name));

if (process.platform === "darwin") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert to what it was before, that was much cleaner, but put the realPathSync call inside normalizeSlashes instead of ourside to prevent windows breaking

Copy link
Contributor Author

@aabajyan aabajyan Feb 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing. sorry about that. Done.

@Perryvw Perryvw merged commit 4142750 into TypeScriptToLua:master Feb 6, 2024
@aabajyan aabajyan deleted the fix-macos-jest branch February 7, 2024 20:12
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.

tsconfig.spec.ts fails in MacOS, because /var is actually located in /private/var

2 participants