@sprucelabs/test-utils 5.3.3 → 5.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,9 +7,10 @@ export default class AbstractSpruceTest {
|
|
7
7
|
protected static resolvePath(...filePath: string[]): string;
|
8
8
|
protected static wait(ms?: number): Promise<unknown>;
|
9
9
|
protected static log(...args: any[]): void;
|
10
|
+
protected cwd: string;
|
10
11
|
protected wait(ms?: number): Promise<unknown>;
|
11
12
|
protected log(...args: any[]): void;
|
12
|
-
protected
|
13
|
+
protected resolvePath(...filePath: string[]): string;
|
13
14
|
protected beforeEach(): Promise<void>;
|
14
15
|
protected afterEach(): Promise<void>;
|
15
16
|
}
|
@@ -5,6 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const path_1 = __importDefault(require("path"));
|
7
7
|
class AbstractSpruceTest {
|
8
|
+
constructor() {
|
9
|
+
//instance declariations
|
10
|
+
this.cwd = process.cwd();
|
11
|
+
}
|
8
12
|
static async beforeAll() {
|
9
13
|
this.cwd = process.cwd();
|
10
14
|
}
|
@@ -30,16 +34,29 @@ class AbstractSpruceTest {
|
|
30
34
|
setTimeout(() => resolve(true), ms);
|
31
35
|
});
|
32
36
|
}
|
33
|
-
//instance declariations
|
34
37
|
static log(...args) {
|
35
38
|
const str = args.map((a) => `${a}`).join(' ');
|
36
39
|
process.stderr.write(str);
|
37
40
|
}
|
38
41
|
async wait(ms = 1000) {
|
39
|
-
return
|
42
|
+
return new Promise((resolve) => {
|
43
|
+
setTimeout(() => resolve(true), ms);
|
44
|
+
});
|
40
45
|
}
|
41
46
|
log(...args) {
|
42
|
-
|
47
|
+
const str = args.map((a) => `${a}`).join(' ');
|
48
|
+
process.stderr.write(str);
|
49
|
+
}
|
50
|
+
resolvePath(...filePath) {
|
51
|
+
const cwd = this.cwd;
|
52
|
+
let builtPath = path_1.default.join(...filePath);
|
53
|
+
if (builtPath[0] !== '/') {
|
54
|
+
if (builtPath.substr(0, 2) === './') {
|
55
|
+
builtPath = builtPath.substr(1);
|
56
|
+
}
|
57
|
+
builtPath = path_1.default.join(cwd, builtPath);
|
58
|
+
}
|
59
|
+
return builtPath;
|
43
60
|
}
|
44
61
|
async beforeEach() { }
|
45
62
|
async afterEach() { }
|
@@ -7,9 +7,10 @@ export default class AbstractSpruceTest {
|
|
7
7
|
protected static resolvePath(...filePath: string[]): string;
|
8
8
|
protected static wait(ms?: number): Promise<unknown>;
|
9
9
|
protected static log(...args: any[]): void;
|
10
|
+
protected cwd: string;
|
10
11
|
protected wait(ms?: number): Promise<unknown>;
|
11
12
|
protected log(...args: any[]): void;
|
12
|
-
protected
|
13
|
+
protected resolvePath(...filePath: string[]): string;
|
13
14
|
protected beforeEach(): Promise<void>;
|
14
15
|
protected afterEach(): Promise<void>;
|
15
16
|
}
|
@@ -1,5 +1,9 @@
|
|
1
1
|
import path from 'path';
|
2
2
|
export default class AbstractSpruceTest {
|
3
|
+
constructor() {
|
4
|
+
//instance declariations
|
5
|
+
this.cwd = process.cwd();
|
6
|
+
}
|
3
7
|
static async beforeAll() {
|
4
8
|
this.cwd = process.cwd();
|
5
9
|
}
|
@@ -25,16 +29,29 @@ export default class AbstractSpruceTest {
|
|
25
29
|
setTimeout(() => resolve(true), ms);
|
26
30
|
});
|
27
31
|
}
|
28
|
-
//instance declariations
|
29
32
|
static log(...args) {
|
30
33
|
const str = args.map((a) => `${a}`).join(' ');
|
31
34
|
process.stderr.write(str);
|
32
35
|
}
|
33
36
|
async wait(ms = 1000) {
|
34
|
-
return
|
37
|
+
return new Promise((resolve) => {
|
38
|
+
setTimeout(() => resolve(true), ms);
|
39
|
+
});
|
35
40
|
}
|
36
41
|
log(...args) {
|
37
|
-
|
42
|
+
const str = args.map((a) => `${a}`).join(' ');
|
43
|
+
process.stderr.write(str);
|
44
|
+
}
|
45
|
+
resolvePath(...filePath) {
|
46
|
+
const cwd = this.cwd;
|
47
|
+
let builtPath = path.join(...filePath);
|
48
|
+
if (builtPath[0] !== '/') {
|
49
|
+
if (builtPath.substr(0, 2) === './') {
|
50
|
+
builtPath = builtPath.substr(1);
|
51
|
+
}
|
52
|
+
builtPath = path.join(cwd, builtPath);
|
53
|
+
}
|
54
|
+
return builtPath;
|
38
55
|
}
|
39
56
|
async beforeEach() { }
|
40
57
|
async afterEach() { }
|