Documentation
¶
Index ¶
- type FileHandle
- type Fixture
- type MonorepoFixture
- type MonorepoHandle
- func (m MonorepoHandle) Package(index int) ProjectHandle
- func (m MonorepoHandle) Packages() []ProjectHandle
- func (m MonorepoHandle) Root() string
- func (m MonorepoHandle) RootDependencies() []string
- func (m MonorepoHandle) RootNodeModules() []NodeModulesPackageHandle
- func (m MonorepoHandle) RootPackageJSONFile() FileHandle
- func (m MonorepoHandle) RootTSConfig() FileHandle
- type MonorepoPackageConfig
- type MonorepoPackageTemplate
- type MonorepoSetupConfig
- type NodeModulesPackageHandle
- type ProjectFileHandle
- type ProjectHandle
- func (p ProjectHandle) Dependencies() []string
- func (p ProjectHandle) File(index int) ProjectFileHandle
- func (p ProjectHandle) Files() []ProjectFileHandle
- func (p ProjectHandle) NodeModuleByName(name string) *NodeModulesPackageHandle
- func (p ProjectHandle) NodeModules() []NodeModulesPackageHandle
- func (p ProjectHandle) PackageJSONFile() FileHandle
- func (p ProjectHandle) Root() string
- func (p ProjectHandle) TSConfig() FileHandle
- type SymlinkSpec
- type TextFileSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileHandle ¶
type FileHandle struct {
// contains filtered or unexported fields
}
FileHandle represents a file created for an autoimport lifecycle test.
func (FileHandle) Content ¶
func (f FileHandle) Content() string
func (FileHandle) FileName ¶
func (f FileHandle) FileName() string
func (FileHandle) URI ¶
func (f FileHandle) URI() lsproto.DocumentUri
type Fixture ¶
type Fixture struct {
// contains filtered or unexported fields
}
Fixture encapsulates a fully-initialized auto import lifecycle test session.
func SetupLifecycleSession ¶
SetupLifecycleSession builds a basic single-project workspace configured with the requested number of TypeScript files and a single synthetic node_modules package.
func (*Fixture) Project ¶
func (f *Fixture) Project(index int) ProjectHandle
func (*Fixture) Projects ¶
func (f *Fixture) Projects() []ProjectHandle
func (*Fixture) SingleProject ¶
func (f *Fixture) SingleProject() ProjectHandle
func (*Fixture) Utils ¶
func (f *Fixture) Utils() *projecttestutil.SessionUtils
type MonorepoFixture ¶
type MonorepoFixture struct {
// contains filtered or unexported fields
}
MonorepoFixture encapsulates a fully-initialized monorepo lifecycle test session.
func SetupMonorepoLifecycleSession ¶
func SetupMonorepoLifecycleSession(t *testing.T, config MonorepoSetupConfig) *MonorepoFixture
SetupMonorepoLifecycleSession builds a monorepo workspace with root-level node_modules and multiple packages, each potentially with their own node_modules. The structure is:
root/
├── tsconfig.json (base config)
├── package.json
├── node_modules/
│ └── <rootNodeModuleCount packages>
└── packages/
├── package-a/
│ ├── tsconfig.json
│ ├── package.json
│ ├── node_modules/
│ │ └── <package-specific packages>
│ └── *.ts files
└── package-b/
└── ...
func (*MonorepoFixture) ExtraFile ¶
func (f *MonorepoFixture) ExtraFile(path string) FileHandle
func (*MonorepoFixture) ExtraFiles ¶
func (f *MonorepoFixture) ExtraFiles() []FileHandle
func (*MonorepoFixture) Monorepo ¶
func (f *MonorepoFixture) Monorepo() MonorepoHandle
func (*MonorepoFixture) Session ¶
func (f *MonorepoFixture) Session() *project.Session
func (*MonorepoFixture) Utils ¶
func (f *MonorepoFixture) Utils() *projecttestutil.SessionUtils
type MonorepoHandle ¶
type MonorepoHandle struct {
// contains filtered or unexported fields
}
MonorepoHandle exposes the generated monorepo layout including root and packages.
func (MonorepoHandle) Package ¶
func (m MonorepoHandle) Package(index int) ProjectHandle
func (MonorepoHandle) Packages ¶
func (m MonorepoHandle) Packages() []ProjectHandle
func (MonorepoHandle) Root ¶
func (m MonorepoHandle) Root() string
func (MonorepoHandle) RootDependencies ¶
func (m MonorepoHandle) RootDependencies() []string
func (MonorepoHandle) RootNodeModules ¶
func (m MonorepoHandle) RootNodeModules() []NodeModulesPackageHandle
func (MonorepoHandle) RootPackageJSONFile ¶
func (m MonorepoHandle) RootPackageJSONFile() FileHandle
func (MonorepoHandle) RootTSConfig ¶
func (m MonorepoHandle) RootTSConfig() FileHandle
type MonorepoPackageConfig ¶
type MonorepoPackageConfig struct {
FileCount int
MonorepoPackageTemplate
}
type MonorepoPackageTemplate ¶
type MonorepoPackageTemplate struct {
Name string
NodeModuleNames []string
DependencyNames []string
}
MonorepoPackageTemplate captures the reusable settings for a package.json scope: the node_modules packages that exist alongside the package.json and the dependency names that should be written into that package.json. When DependencyNames is empty, all available node_modules packages in scope are used.
type MonorepoSetupConfig ¶
type MonorepoSetupConfig struct {
Root string
MonorepoPackageTemplate
Packages []MonorepoPackageConfig
ExtraFiles []TextFileSpec
Symlinks []SymlinkSpec
}
MonorepoSetupConfig describes the monorepo root and packages to create. The embedded MonorepoPackageTemplate describes the monorepo root package located at Root. DependencyNames defaults to NodeModuleNames when empty. Package.MonorepoPackageTemplate.DependencyNames defaults to the union of the root node_modules packages and the package's own NodeModuleNames when empty.
type NodeModulesPackageHandle ¶
type NodeModulesPackageHandle struct {
Name string
Directory string
// contains filtered or unexported fields
}
NodeModulesPackageHandle describes a generated package under node_modules.
func (NodeModulesPackageHandle) DeclarationFile ¶
func (p NodeModulesPackageHandle) DeclarationFile() FileHandle
func (NodeModulesPackageHandle) PackageJSONFile ¶
func (p NodeModulesPackageHandle) PackageJSONFile() FileHandle
type ProjectFileHandle ¶
type ProjectFileHandle struct {
FileHandle
// contains filtered or unexported fields
}
ProjectFileHandle adds export metadata for TypeScript source files.
type ProjectHandle ¶
type ProjectHandle struct {
// contains filtered or unexported fields
}
ProjectHandle exposes the generated project layout for a fixture project root.
func (ProjectHandle) Dependencies ¶
func (p ProjectHandle) Dependencies() []string
func (ProjectHandle) File ¶
func (p ProjectHandle) File(index int) ProjectFileHandle
func (ProjectHandle) Files ¶
func (p ProjectHandle) Files() []ProjectFileHandle
func (ProjectHandle) NodeModuleByName ¶
func (p ProjectHandle) NodeModuleByName(name string) *NodeModulesPackageHandle
func (ProjectHandle) NodeModules ¶
func (p ProjectHandle) NodeModules() []NodeModulesPackageHandle
func (ProjectHandle) PackageJSONFile ¶
func (p ProjectHandle) PackageJSONFile() FileHandle
func (ProjectHandle) Root ¶
func (p ProjectHandle) Root() string
func (ProjectHandle) TSConfig ¶
func (p ProjectHandle) TSConfig() FileHandle
type SymlinkSpec ¶
type SymlinkSpec struct {
Link string // The symlink path
Target string // The target path the symlink points to
}
SymlinkSpec describes a symlink to create in the fixture.
type TextFileSpec ¶
TextFileSpec describes an additional file to place in the fixture.