Skip to content

Commit 50fe3d8

Browse files
committed
test: merge the tests to share resources to fix macos crashes
1 parent bb2eefc commit 50fe3d8

File tree

1 file changed

+12
-24
lines changed

1 file changed

+12
-24
lines changed

test/auto-languageclient.test.ts

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,51 +35,39 @@ function setupServerManager(client = setupClient()) {
3535

3636
describe("AutoLanguageClient", () => {
3737
describe("determineProjectPath", () => {
38-
it("returns null when a single file is open", async () => {
39-
const client = setupClient()
40-
const textEditor = (await atom.workspace.open(__filename)) as TextEditor
41-
/* eslint-disable-next-line dot-notation */
42-
const projectPath = client["determineProjectPath"](textEditor)
43-
expect(projectPath).toBeNull()
44-
})
45-
it("returns the project path when a file of that project is open", async () => {
46-
// macos has issues with handling too much resources
47-
if (process.platform === "darwin") {
48-
return
49-
}
38+
it("returns the project path for an internal or an external file in the project", async () => {
5039
const client = setupClient()
5140
const serverManager = setupServerManager(client)
5241

42+
// "returns null when a single file is open"
43+
44+
let textEditor = (await atom.workspace.open(__filename)) as TextEditor
45+
/* eslint-disable-next-line dot-notation */
46+
expect(client["determineProjectPath"](textEditor)).toBeNull()
47+
textEditor.destroy()
48+
49+
// "returns the project path when a file of that project is open"
5350
const projectPath = __dirname
5451

5552
// gives the open workspace folder
5653
atom.project.addPath(projectPath)
5754
await serverManager.startServer(projectPath)
5855

59-
const textEditor = (await atom.workspace.open(__filename)) as TextEditor
56+
textEditor = (await atom.workspace.open(__filename)) as TextEditor
6057
/* eslint-disable-next-line dot-notation */
6158
expect(client["determineProjectPath"](textEditor)).toBe(normalizePath(projectPath))
62-
})
63-
it("returns the project path for an external file if it is in additional paths", async () => {
64-
// macos has issues with handling too much resources
65-
if (process.platform === "darwin") {
66-
return
67-
}
59+
textEditor.destroy()
6860

6961
// "returns the project path when an external file is open and it is not in additional paths"
7062

71-
const client = setupClient()
72-
const serverManager = setupServerManager(client)
73-
74-
const projectPath = __dirname
7563
const externalDir = join(dirname(projectPath), "lib")
7664
const externalFile = join(externalDir, "main.js")
7765

7866
// gives the open workspace folder
7967
atom.project.addPath(projectPath)
8068
await serverManager.startServer(projectPath)
8169

82-
let textEditor = (await atom.workspace.open(externalFile)) as TextEditor
70+
textEditor = (await atom.workspace.open(externalFile)) as TextEditor
8371
/* eslint-disable-next-line dot-notation */
8472
expect(client["determineProjectPath"](textEditor)).toBeNull()
8573
textEditor.destroy()

0 commit comments

Comments
 (0)