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

[Question] Give tree to ts-morph #1590

Open
meliecool opened this issue Dec 9, 2024 · 0 comments
Open

[Question] Give tree to ts-morph #1590

meliecool opened this issue Dec 9, 2024 · 0 comments

Comments

@meliecool
Copy link

Hi,

Not sure it is the place for it, but I don't know if there is a possibility to give a tree to ts-morph. I don't find any documentation for tests and I know some issues are open about it, but if it would be possible to give a mock tree to ts-morph, instead of it taking the tree of the workspace by default, it would greatly help!

For more context, I'm using nx and create a fake tree with it to not test my repository, but only my fake tree.

Something like:

import { createTree } from '@nx/devkit/testing';
import { Project } from 'ts-morph';

const tree = createTree();

const project = new Project({ customTree: tree });
project.addSourceFileAtPath('any/file/path.ts');
@meliecool meliecool changed the title [Question] Give tree [Question] Give tree to ts-morph Dec 9, 2024
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

No branches or pull requests

1 participant