Skip to content

Commit 955d702

Browse files
committed
Moved some tests functions
1 parent 295b513 commit 955d702

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

__tests__/common.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import * as path from 'path'
2+
import * as os from 'os'
3+
4+
export const TEST_DIR = path.join(os.tmpdir(), 'test-create-changelog')

__tests__/git.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,18 @@ import * as exec from '@actions/exec'
22
import * as uuid from 'uuid'
33
import * as io from '@actions/io'
44
import * as path from 'path'
5-
import * as os from 'os'
65
import * as fs from 'fs'
76
import {Git} from '../src/git'
87
import {Settings} from '../src/settings'
9-
10-
const testDir = path.join(os.tmpdir(), 'test-create-changelog')
8+
import {TEST_DIR} from './common'
119

1210
async function runGit(args: string[], cwd: string) {
1311
const gitPath = await io.which('git', true)
1412
await exec.exec(`"${gitPath}"`, args, {cwd})
1513
}
1614

1715
async function initTestRepo(): Promise<string> {
18-
const cwd = path.join(testDir, uuid.v4())
16+
const cwd = path.join(TEST_DIR, uuid.v4())
1917
await io.mkdirP(cwd)
2018
await runGit(['init', '.'], cwd)
2119
return cwd
@@ -34,7 +32,7 @@ async function createAndCommitFile(name: string, message: string, cwd: string) {
3432

3533
describe('Git commands', () => {
3634
afterAll(() => {
37-
io.rmRF(testDir)
35+
io.rmRF(TEST_DIR)
3836
})
3937

4038
it('Verifies tag is returned if checked out on same commit', async () => {

0 commit comments

Comments
 (0)