Skip to content

Commit 530b19b

Browse files
committed
Fix code
1 parent f000d65 commit 530b19b

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

test/index.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ test('diff() (travis)', function (t) {
130130

131131
return processor.process(vfile({path: 'new.txt', contents: other}))
132132
})
133+
// Restore
134+
.then(restore, restore)
133135
.then(
134136
() => t.pass('should pass'),
135137
(error) => t.ifErr(error, 'should not fail')
136138
)
137-
// Restore
138-
.then(restore, restore)
139139

140140
function restore() {
141141
delete process.env.TRAVIS_COMMIT_RANGE
@@ -160,8 +160,6 @@ test('diff() (GitHub Actions)', function (t) {
160160
t.plan(3)
161161

162162
exec('git init')
163-
// Set up.
164-
.then(() => exec('git config --global user.email').catch(setEmailAndName))
165163
// Add initial file.
166164
.then(() => vfile.write({path: 'example.txt', contents: stepOne}))
167165
.then(() => exec('git add example.txt'))
@@ -210,16 +208,17 @@ test('diff() (GitHub Actions)', function (t) {
210208
)
211209
})
212210
// Restore
211+
.then(restore, restore)
213212
.then(
214213
() => t.pass('should pass'),
215214
(error) => t.ifErr(error, 'should not fail')
216215
)
217-
.then(restore, restore)
218216

219217
function restore() {
220-
return rimraf('.git')
221-
.then(() => rimraf('new.txt'))
222-
.then(() => rimraf('example.txt'))
218+
delete process.env.GITHUB_SHA
219+
delete process.env.GITHUB_BASE_REF
220+
delete process.env.GITHUB_HEAD_REF
221+
return rimraf('.git').then(() => rimraf('example.txt'))
223222
}
224223
})
225224

0 commit comments

Comments
 (0)