Passed
Push — master ( 5a7415...589359 )
by Dmytro
01:40
created

Test   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 10
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A setTmpFolder 0 4 1
A cleanTmpFolder 0 3 1
1
import path from 'path';
2
import fse from 'fs-extra';
3
import { tmpFolder, fixturesFolder, entry } from './constants';
4
import './mock';
5
import './init-hooks';
6
// import * as utils from './utils';
7
8
export default class Test {
9
    async setTmpFolder() {
10
        await this.cleanTmpFolder();
11
        await fse.ensureDir(tmpFolder);
12
    }
13
14
    async cleanTmpFolder() {
15
        await fse.remove(tmpFolder);
16
    }
17
}
18
19
function load(relPath) {
20
    // eslint-disable-next-line security/detect-non-literal-require
21
    return require(path.join(entry, relPath));
22
}
23
24
function resolve(relPath) {
25
    return require.resolve(path.join(entry, relPath));
26
}
27
28
export {
29
    tmpFolder,
30
    fixturesFolder,
31
    entry,
32
    load,
33
    resolve
34
};
35
36
export * from './utils';
37