yo-unit 0.16.1 → 0.17.0
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.
- package/package.json +1 -1
- package/src/__tests__/GetYoUnitTest.js +3 -3
- package/src/index.js +18 -20
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const { expect } = require("chai");
|
|
2
|
-
const
|
|
2
|
+
const { YoTest, assert } = require("../index");
|
|
3
3
|
|
|
4
4
|
describe("Test yo-unit", () => {
|
|
5
5
|
it("basic testt", () => {
|
|
6
|
-
|
|
7
|
-
expect(
|
|
6
|
+
expect(YoTest).is.not.null;
|
|
7
|
+
expect(assert).is.not.null;
|
|
8
8
|
});
|
|
9
9
|
});
|
package/src/index.js
CHANGED
|
@@ -2,27 +2,25 @@ const PATH = require("path");
|
|
|
2
2
|
const { STRING } = require("reshow-constant");
|
|
3
3
|
|
|
4
4
|
// for test
|
|
5
|
-
const
|
|
5
|
+
const YoTestLib = require("yeoman-test");
|
|
6
6
|
const assert = require("yeoman-assert");
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
.build(build)
|
|
22
|
-
.run();
|
|
23
|
-
},
|
|
24
|
-
assert,
|
|
25
|
-
};
|
|
8
|
+
const YoTest = ({ source, params, options = {}, build }) => {
|
|
9
|
+
const isStringSource = STRING === typeof source;
|
|
10
|
+
source = isStringSource ? PATH.join(source) : source;
|
|
11
|
+
const sourceName = isStringSource ? source : source.name;
|
|
12
|
+
return YoTestLib.create(source)
|
|
13
|
+
.withPrompts(params)
|
|
14
|
+
.withOptions(options)
|
|
15
|
+
.inTmpDir((dir) => {
|
|
16
|
+
console.log(`Build Dest on: ${dir}`);
|
|
17
|
+
console.log(`Source : ${sourceName}`);
|
|
18
|
+
})
|
|
19
|
+
.build(build)
|
|
20
|
+
.run();
|
|
26
21
|
};
|
|
27
22
|
|
|
28
|
-
module.exports =
|
|
23
|
+
module.exports = {
|
|
24
|
+
YoTest,
|
|
25
|
+
assert
|
|
26
|
+
};
|