Is it possible to read a file from an absolute path? #9637
Answered
by
bahmutov
cjcrandall
asked this question in
Questions and Help
Replies: 3 comments 2 replies
-
Only by using cy.task
…Sent from my iPhone
On Dec 10, 2020, at 18:54, cjcrandall ***@***.***> wrote:
From the docs, cy.fixture assumes a relative path from the fixtures folder, and cy.readFile assumes a relative path from the project root. But is it possible with either of these, or some other means, to read a file from an absolute file path?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Well you could also just import the json file directly since the bundler will bundle spec files and anything they import.
…Sent from my iPhone
On Dec 10, 2020, at 19:35, cjcrandall ***@***.***> wrote:
That's an interesting design decision. Do you know what the rationale is or if that might be changed in the future? I can use ../ to navigate out of those default directories but that feels a bit hacky. In my use case, I have json files that are part of the production code (so don't belong in a fixtures folder) that I want to load, and I also have multiple cypress projects in my repo.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
cjcrandall
-
You can change the path of the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
From the docs,
cy.fixture
assumes a relative path from the fixtures folder, andcy.readFile
assumes a relative path from the project root. But is it possible with either of these, or some other means, to read a file from an absolute file path?Beta Was this translation helpful? Give feedback.
All reactions