Skip to content

Commit 60ee200

Browse files
only move mysqlmsn foler if it exists
1 parent ab2554a commit 60ee200

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/versions.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { coerce, satisfies } from 'semver';
55
import { ServerOptions } from '../types';
66
import getBinaryURL from '../src/libraries/Version';
77
import { DOWNLOADABLE_MYSQL_VERSIONS } from '../src/constants';
8+
import fs from 'fs'
89
import fsPromises from 'fs/promises'
910
import os from 'os'
1011

@@ -61,7 +62,8 @@ test('dummy test', () => {
6162
})
6263

6364
afterAll(async () => {
64-
if (process.env.MOVE_MYSQLMSN_TO) {
65-
await fsPromises.rename(`${os.tmpdir()}/mysqlmsn`, process.env.MOVE_MYSQLMSN_TO)
65+
const originalPath = `${os.tmpdir()}/mysqlmsn`
66+
if (process.env.MOVE_MYSQLMSN_TO && fs.existsSync(originalPath)) {
67+
await fsPromises.rename(originalPath, process.env.MOVE_MYSQLMSN_TO)
6668
}
6769
})

0 commit comments

Comments
 (0)