Skip to content

Commit 542d0b9

Browse files
committed
chore: add the silent option when executing the git command
1 parent 25c719a commit 542d0b9

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

e2e/helpers/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import shell from 'shelljs'
12
import { DefaultTreeSection } from 'wdio-vscode-service'
23
import type { StatusStrings } from 'assertions/index.ts'
34
import type { TreeItem, Workbench, ViewControl, ViewContent, ViewItemAction, ViewTitlePart } from 'wdio-vscode-service'
@@ -121,3 +122,7 @@ export async function collapseAllTests(testingSection: DefaultTreeSection) {
121122
}
122123
}
123124
}
125+
126+
export function resetFileChange(filePath: string) {
127+
shell.exec(`git checkout ${filePath}`, { silent: true })
128+
}

e2e/tests/envEnable.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
collapseAllTests,
1313
getTestingSection,
1414
openTestingView,
15+
resetFileChange,
1516
waitForResolved,
1617
waitForTestStatus,
1718
} from '../helpers/index.js'
@@ -44,7 +45,7 @@ describe('VS Code Extension Testing (EnableEnv)', function () {
4445
})
4546

4647
after(function () {
47-
shell.exec(`git checkout ${envPath}`)
48+
resetFileChange(envPath)
4849
})
4950

5051
it('should be resolved the defined tests before run tests', async function () {

e2e/tests/updateConfig.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
collapseAllTests,
1313
getTestingSection,
1414
openTestingView,
15+
resetFileChange,
1516
waitForResolved,
1617
waitForTestStatus,
1718
} from '../helpers/index.js'
@@ -42,7 +43,7 @@ describe('VS Code Extension Testing (Update config)', function () {
4243
})
4344

4445
after(function () {
45-
shell.exec(`git checkout ${beforeConfig}`)
46+
resetFileChange(beforeConfig)
4647
})
4748

4849
it('should be resolved the defined tests after configuration changed', async function () {

e2e/tests/updateErrorConfig.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
collapseAllTests,
1212
getTestingSection,
1313
openTestingView,
14+
resetFileChange,
1415
waitForResolved,
1516
waitForTestStatus,
1617
} from '../helpers/index.js'
@@ -43,7 +44,7 @@ describe('VS Code Extension Testing (Update config)', function () {
4344
})
4445

4546
after(function () {
46-
shell.exec(`git checkout ${beforeConfig}`)
47+
resetFileChange(beforeConfig)
4748
})
4849

4950
it('should be resolved the configuration file with no spec files', async function () {
@@ -99,7 +100,7 @@ describe('VS Code Extension Testing (Update config)', function () {
99100
const testingSection = await getTestingSection(sideBarView.getContent())
100101
const items = await testingSection.getVisibleItems()
101102

102-
shell.exec(`git checkout ${beforeConfig}`)
103+
resetFileChange(beforeConfig)
103104
await new Promise((resolve) => setTimeout(resolve, 1000))
104105

105106
await clickTreeItemButton(browser, items[0], 'Run Test')

e2e/tests/updateErrorSpec.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
collapseAllTests,
1212
getTestingSection,
1313
openTestingView,
14+
resetFileChange,
1415
waitForResolved,
1516
waitForTestStatus,
1617
} from '../helpers/index.js'
@@ -47,7 +48,7 @@ describe('VS Code Extension Testing (Update config)', function () {
4748
})
4849

4950
after(function () {
50-
shell.exec(`git checkout ${spec.before}`)
51+
resetFileChange(spec.before)
5152
})
5253

5354
it('should be resolved the no tests after spec file is changed with invalid syntax', async function () {
@@ -175,7 +176,7 @@ describe('VS Code Extension Testing (Update config)', function () {
175176
const testingSection = await getTestingSection(sideBarView.getContent())
176177
const items = await testingSection.getVisibleItems()
177178

178-
shell.exec(`git checkout ${spec.before}`)
179+
resetFileChange(spec.before)
179180
await new Promise((resolve) => setTimeout(resolve, 1000))
180181

181182
await clickTreeItemButton(browser, items[0], 'Run Test')

e2e/tests/updateSpec.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
collapseAllTests,
1212
getTestingSection,
1313
openTestingView,
14+
resetFileChange,
1415
waitForResolved,
1516
waitForTestStatus,
1617
} from '../helpers/index.js'
@@ -47,7 +48,7 @@ describe('VS Code Extension Testing (Update config)', function () {
4748
})
4849

4950
after(function () {
50-
shell.exec(`git checkout ${spec.before}`)
51+
resetFileChange(spec.before)
5152
})
5253

5354
it('should be resolved the defined tests after spec file is changed', async function () {

0 commit comments

Comments
 (0)