Suggestion: change the base path of loadFeature from cwd to the caller file's paths
Closed this issue · 4 comments
outline
as-is
// ./src/path/to/feature/foo.test.tsx
import { loadFeature } from '@amiceli/vitest-cucumber'
const feature = await loadFeature('./src/path/to/feature/foo.feature')
// ...
to-do
// ./src/path/to/feature/foo.test.tsx
import { loadFeature } from '@amiceli/vitest-cucumber'
const feature = await loadFeature('./foo.feature')
// ...
explanation
Hello there!
I think the base path of loadFeature on as-is could cause a little trouble when we move a spec (or test) file to another path.
(whenever that happens, it seems that we need to change each path that is passed to loadFeature as a parameter.)
so, I suggest changing the base path of it to the caller file's paths.
or what do you think about making a loader for the feature file and connecting its result with your package?
I appreciate your efforts for this package.
related link
vitest-cucumber/src/vitest/load-feature.ts
Lines 9 to 10 in 10f97b6
Hi @ytw0728 ,
Your issue is a good point ;).
I make some search about it and I found posts and/or framework docs using both solutions : same folder or different folders.
So I will work on it to allow both ways.
I will show you it on this issue and you will give me your opinion ;)
It's done, I have published a new version https://github.com/amiceli/vitest-cucumber/releases/tag/v3.2.3
You can install new version to use relative path ;).