1
|
|
|
import path from 'path'; |
2
|
|
|
import { assert } from 'chai'; |
3
|
|
|
import fs from 'fs-extra'; |
4
|
|
|
import Test, { load, fixturesFolder, tmpFolder } from '../Test'; |
5
|
|
|
|
6
|
|
|
import '../utils'; |
7
|
|
|
|
8
|
|
|
const { tarball } = load('utils'); |
9
|
|
|
const t = new Test(); |
10
|
|
|
|
11
|
|
|
suite('tar'); |
12
|
|
|
|
13
|
|
|
before(async function () { |
14
|
|
|
await t.setTmpFolder(); |
15
|
|
|
}); |
16
|
|
|
|
17
|
|
|
test('Positive: pack folder default ignore', async function () { |
18
|
|
|
const file = await tarball( |
19
|
|
|
path.join(fixturesFolder, 'txt_file'), |
20
|
|
|
tmpFolder |
21
|
|
|
); |
22
|
|
|
|
23
|
|
|
await assert.isTarEqual(file, path.join(fixturesFolder, 'txt_file.tar')); |
24
|
|
|
}); |
25
|
|
|
|
26
|
|
|
|
27
|
|
|
test('Positive: pack folder with .gitignore', async function () { |
28
|
|
|
await fs.move( |
29
|
|
|
path.join(fixturesFolder, 'gitignore', '.herokuignore'), |
30
|
|
|
path.join(fixturesFolder, 'gitignore', '.gitignore') |
31
|
|
|
); |
32
|
|
|
try { |
33
|
|
|
const file = await tarball( |
34
|
|
|
path.join(fixturesFolder, 'gitignore'), |
35
|
|
|
tmpFolder |
36
|
|
|
); |
37
|
|
|
|
38
|
|
|
await assert.isTarEqual(file, path.join(fixturesFolder, 'gitignore.tar')); |
39
|
|
|
} finally { |
40
|
|
|
await fs.move( |
41
|
|
|
path.join(fixturesFolder, 'gitignore', '.gitignore'), |
42
|
|
|
path.join(fixturesFolder, 'gitignore', '.herokuignore') |
43
|
|
|
); |
44
|
|
|
} |
45
|
|
|
}); |
46
|
|
|
|
47
|
|
|
after(async function () { |
48
|
|
|
await t.cleanTmpFolder(); |
49
|
|
|
}); |
50
|
|
|
|