-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat: Checkly check-parser use the paths alias defined in tsconfig.json #884
Comments
Same issue here, nextjs project with a tsconfig alias setup, means that I can't use checkly, or I need to rewrite all the paths in my project (not possible) |
Same issue here. This is default typescript functionality, and would enable easier user adoption for your product. ➕ |
+1 to this, please support tsconfig paths. |
I'll be looking into this soon after some higher priority items. |
This is being worked on in #1006. The branch currently already supports collecting the correct set of files, but unfortunately the backend also needs to know the tsconfig path mapping, and that will require backend changes. |
I thought you might like to know i've pivoted away from using the The approach I have taken is to use https://rollupjs.org/, I target my spec file and let rollup tree shake the dependencies required into a You can see my local code here: And then what gets uploaded to checkly: This solves so many problems. In my personal opinion, this is why you need to ensure the checkly-api is fully featured and you aren't pushing people to use your cli with private / hidden APIs. It enables customers to solve the problems that they face in a timely manner rather than relying on your cli abstraction to fix all their problems. Equally, you might get some interesting ideas/concepts coming out of customers - such as this, that might open up new ways of thinking about the problem space. |
This feature is now available in @Stono Sorry for missing your response. What you've done is very cool. It is unfortunate that the CLI is currently not able to provide a complete solution for you, but I am glad that you have found a way to make the platform work the way you want it to work. We have no intention to intentionally break the APIs used by the CLI, so your solution should continue to work, but there may eventually come a time when incompatible changes are introduced and/or we start using different APIs. Note that you may wish to "pretend" to be the CLI by sending the We are currently a bit limited on the backend side (or rather, runner-side, if that term makes sense) due to a certain outdated wrapper module that is hard to work with. It is due for removal in the relatively short term, though, so hopefully we will be able to support even more complex features in the future, including support for private/custom dependencies. Thanks for the ideas! |
What problem does this feature solve?
Currently the Checkly's
check-parser
does not consider https://www.typescriptlang.org/tsconfig#paths when resolving local imported files.With some paths alias defined in tsconfig.json for the project:
Any spec files that use an alias in the import statement will also work in Checkly like it already does in Playwright.
import { baseURL } from '_checkly/constants';
Today this does not work and you get this error:
This is because Checkly check-parser is not resolving the alias to the local file and instead assumes an NPM package.
How would you implement this feature?
Improve the Checkly's
check-parser
to use the the information in the tsconfig.json file to resolve any import of a local file that use an alias at the beginning of the import path.import { baseURL } from '_checkly/constants';
import { foo } from '_/someFolder/foo';
becomes
import { baseURL } from './checkly/constants';
import { foo } from './src/someFolder/foo';
https://www.typescriptlang.org/tsconfig#paths
The text was updated successfully, but these errors were encountered: