GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: add `tmpdir.fileURL()` by LiviaMedeiros · Pull Request #49040 · nodejs/node

Conversation

@LiviaMedeiros

@LiviaMedeiros LiviaMedeiros commented Aug 6, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Almost every time tmpdir.path is used in tests, we have to import path to use it.
Whenever we need URL of something in tmpdir, we also have to import url.pathToFileURL.
Adding tmpdir.url would reduce

import { join } from 'node:path';
import { pathToFileURL } from 'node:url';
const testFile = pathToFileURL(join(tmpdir.path, 'subdir', 'tst-file-123'));

to

const testFile = tmpdir.resolve('subdir', 'tst-file-123');

or to native resolving

const tmpBase = tmpdir.fileURL();
const testFile = new URL('subdir/tst-file-123', tmpBase);

Additionally, maybe we could add path-oriented tmpdir.resolve(...paths) to replace path.join(tmpdir.path, ...paths) in tests?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to Node.js core tests and test infrastructure. labels Aug 6, 2023
@tniessen

tniessen commented Aug 6, 2023

Copy link
Copy Markdown
Member

Why is the URL not a URL?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@LiviaMedeiros

LiviaMedeiros commented Aug 6, 2023

Copy link
Copy Markdown
Member Author

Why is the URL not a URL?

For consistency with import.meta.url and general guideline. No strong opinion here.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tniessen

tniessen commented Aug 6, 2023

Copy link
Copy Markdown
Member

I see. For anyone else wondering the same thing, it sounds like the main issue is that URL is meant to be mutable, which is undesirable for values that are not meant to be modified.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95

aduh95 commented Aug 8, 2023

Copy link
Copy Markdown
Contributor

We could have tmpdir.fileURL() which would return a new URL instance, and would accept a relative URL as optional parameter, that would be consistent with fixtures.mjs. wdyt?

LiviaMedeiros reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joyeecheung

joyeecheung commented Aug 8, 2023

Copy link
Copy Markdown
Member

Considering we also already have fixtures.fileURL() and fixtures.path() I think tmpdir.fileURL() and tmpdir.resolve() (because tmpdir.path is already taken) would make a lot of sense (I've always wondered why we don't have tmpdir.resolve() whenever I have to do path.join(tmpdir.path))

LiviaMedeiros reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@LiviaMedeiros LiviaMedeiros changed the title test: add tmpdir.url test: add tmpdir.fileURL() Aug 9, 2023
@LiviaMedeiros
test: add tmpdir.fileURL()
0e08b72
@LiviaMedeiros
LiviaMedeiros force-pushed the test-ft-tmpdir-url branch from 1dbf437 to 0e08b72 Compare August 9, 2023 05:41
@LiviaMedeiros LiviaMedeiros added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Aug 9, 2023
aduh95
aduh95 approved these changes Aug 9, 2023
View reviewed changes
@aduh95 aduh95 added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Aug 9, 2023
joyeecheung
joyeecheung approved these changes Aug 9, 2023
View reviewed changes
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Aug 10, 2023
@nodejs-github-bot

This comment was marked as outdated.

Sign in to view
@nodejs-github-bot

This comment was marked as outdated.

Sign in to view
@nodejs-github-bot

nodejs-github-bot commented Aug 10, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/53136/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95 aduh95 added the commit-queue PRs queued for automated landing through the Commit Queue. label Aug 10, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Aug 10, 2023
@nodejs-github-bot
nodejs-github-bot merged commit 7bbcb29 into nodejs:main Aug 10, 2023
@nodejs-github-bot

nodejs-github-bot commented Aug 10, 2023

Copy link
Copy Markdown
Collaborator

Landed in 7bbcb29

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Aug 11, 2023
CI Reliability 2023-08-11 nodejs/reliability#634
Open
1 of 29 tasks
@LiviaMedeiros LiviaMedeiros mentioned this pull request Aug 13, 2023
test,benchmark: use tmpdir.fileURL() #49138
Merged
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
@LiviaMedeiros @Ceres6
test: add tmpdir.fileURL()
a717c88
PR-URL: nodejs#49040
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
@LiviaMedeiros @Ceres6
test: add tmpdir.fileURL()
f9cb59d
PR-URL: nodejs#49040
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
RafaelGSS pushed a commit that referenced this pull request Aug 15, 2023
@LiviaMedeiros @RafaelGSS
test: add tmpdir.fileURL()
946de9c
PR-URL: #49040
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
@UlisesGascon UlisesGascon mentioned this pull request Aug 15, 2023
v20.6.0 proposal #49185
Merged
RafaelGSS pushed a commit to RafaelGSS/node that referenced this pull request Aug 15, 2023
@LiviaMedeiros @RafaelGSS
test: add tmpdir.fileURL()
59767f3
PR-URL: nodejs#49040
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
RafaelGSS pushed a commit that referenced this pull request Aug 17, 2023
@LiviaMedeiros @RafaelGSS
test: add tmpdir.fileURL()
669ac03
PR-URL: #49040
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
nodejs-github-bot pushed a commit that referenced this pull request Aug 21, 2023
@LiviaMedeiros
test,benchmark: use tmpdir.fileURL()
eeddbfa
PR-URL: #49138
Refs: #49040
Reviewed-By: Luigi Pinca <[email protected]>
UlisesGascon pushed a commit that referenced this pull request Sep 10, 2023
@LiviaMedeiros @UlisesGascon
test,benchmark: use tmpdir.fileURL()
fac56db
PR-URL: #49138
Refs: #49040
Reviewed-By: Luigi Pinca <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Nov 11, 2023
@LiviaMedeiros @targos
test: add tmpdir.fileURL()
abedad7
PR-URL: nodejs#49040
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
@targos targos mentioned this pull request Nov 11, 2023
[v18.x] Backport most ESM and customization hook changes #50669
Closed
@targos targos added the backported-to-v18.x label Nov 23, 2023
targos pushed a commit that referenced this pull request Nov 23, 2023
@LiviaMedeiros @targos
test: add tmpdir.fileURL()
65058d9
PR-URL: #49040
Backport-PR-URL: #50669
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
targos pushed a commit that referenced this pull request Nov 27, 2023
@LiviaMedeiros @targos
test,benchmark: use tmpdir.fileURL()
b011a49
PR-URL: #49138
Refs: #49040
Reviewed-By: Luigi Pinca <[email protected]>
@targos targos mentioned this pull request Nov 28, 2023
v18.19.0 release proposal #50953
Merged
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
@sercher
test: add tmpdir.fileURL()
1d47b07
PR-URL: nodejs/node#49040
Backport-PR-URL: nodejs/node#50669
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
@sercher
test,benchmark: use tmpdir.fileURL()
bdcdb85
PR-URL: nodejs/node#49138
Refs: nodejs/node#49040
Reviewed-By: Luigi Pinca <[email protected]>
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
@sercher
test: add tmpdir.fileURL()
82316a5
PR-URL: nodejs/node#49040
Backport-PR-URL: nodejs/node#50669
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
@sercher
test,benchmark: use tmpdir.fileURL()
1eea878
PR-URL: nodejs/node#49138
Refs: nodejs/node#49040
Reviewed-By: Luigi Pinca <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@joyeecheung joyeecheung joyeecheung approved these changes
@aduh95 aduh95 aduh95 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. needs-ci PRs that need a full CI run. test Issues and PRs related to Node.js core tests and test infrastructure.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@LiviaMedeiros @tniessen @aduh95 @joyeecheung @nodejs-github-bot @targos
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.