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

Fix path.format compatibility issue. #4064

Merged
merged 1 commit into from
Aug 8, 2023

Conversation

Hanaasagi
Copy link
Collaborator

@Hanaasagi Hanaasagi commented Aug 8, 2023

What does this PR do?

  1. Check if the argument is an empty string in path.format. Close: path.format({base: ''}) inconsistency with Node #4005
  2. Avoid duplicating '/' at the beginning of the path. Fix following code.
const path = require("node:path");
const assert = require("node:assert");
assert.strictEqual(
  path.format({
    root: "/",
    name: "file",
    ext: ".txt",
  }),
  "/file.txt",
);

In Bun 0.7.3

AssertionError: Expected values to be strictly equal:
+ actual - expected

+ '//file.txt'
- '/file.txt'
  • Documentation or TypeScript types (it's okay to leave the rest blank in this case)
  • Code changes

How did you verify your code works?

I wrote automated tests

  • I ran make js and committed the transpiled changes
  • I or my editor ran Prettier on the changed files (or I ran bun fmt)
  • I included a test for the new code, or an existing test covers it

2. Avoid duplicating '/' at the beginning of the path.
Close: oven-sh#4005
@Jarred-Sumner Jarred-Sumner merged commit 511f6bd into oven-sh:main Aug 8, 2023
@Jarred-Sumner
Copy link
Collaborator

Thank you

trnxdev pushed a commit to trnxdev/bun that referenced this pull request Aug 9, 2023
…h#4064)

2. Avoid duplicating '/' at the beginning of the path.
Close: oven-sh#4005
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.

path.format({base: ''}) inconsistency with Node
2 participants