MCPcopy
hub / github.com/coder/code-server / createWorkspace

Method createWorkspace

test/e2e/models/CodeServer.ts:78–116  ·  view source on GitHub ↗

* Create a random workspace and seed it with settings.

()

Source from the content-addressed store, hash-verified

76 * Create a random workspace and seed it with settings.
77 */
78 private async createWorkspace(): Promise<string> {
79 const dir = await this.workspaceDir
80 await fs.mkdir(path.join(dir, "User"), { recursive: true })
81 await fs.writeFile(
82 path.join(dir, "User/settings.json"),
83 JSON.stringify({
84 "workbench.startupEditor": "none",
85 // Disable the welcome popup so we can avoid having to click through it
86 // on every test.
87 "workbench.welcomePage.experimentalOnboarding": false,
88 }),
89 "utf8",
90 )
91
92 const extensionsDir = path.join(__dirname, "../extensions")
93 const languagepacksContent = {
94 es: {
95 hash: "8d919a946475223861fa0c62665a4c50",
96 extensions: [
97 {
98 extensionIdentifier: {
99 id: "ms-ceintl.vscode-language-pack-es",
100 uuid: "47e020a1-33db-4cc0-a1b4-42f97781749a",
101 },
102 version: "1.70.0",
103 },
104 ],
105 translations: {
106 vscode: `${extensionsDir}/ms-ceintl.vscode-language-pack-es-1.70.0/translations/main.i18n.json`,
107 },
108 label: "español",
109 },
110 }
111
112 // NOTE@jsjoeio - code-server should automatically generate the languagepacks.json for
113 // using different display languages. This is a temporary workaround until we fix that.
114 await fs.writeFile(path.join(dir, "languagepacks.json"), JSON.stringify(languagepacksContent))
115 return dir
116 }
117
118 /**
119 * Spawn a new code-server process with its own workspace and data

Callers 1

spawnMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected