@dannysir/js-te 0.2.1 → 0.2.2
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/README.md +4 -4
- package/bin/cli.js +1 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -153,7 +153,7 @@ Babel을 사용해서 import/require 구문을 변환하여 mock 함수를 가
|
|
|
153
153
|
|
|
154
154
|
**💡 부분 모킹(Partial Mocking)**
|
|
155
155
|
|
|
156
|
-
0.1
|
|
156
|
+
0.2.1 버전부터 모듈의 일부 함수만 모킹하고 나머지는 원본을 사용할 수 있습니다.
|
|
157
157
|
|
|
158
158
|
```javascript
|
|
159
159
|
// math.js
|
|
@@ -378,9 +378,9 @@ test('[partial mocking] - mock only multiply', async () => {
|
|
|
378
378
|
|
|
379
379
|
const { add, subtract, multiply } = await import('./calculator.js');
|
|
380
380
|
|
|
381
|
-
expect(add(2, 3)).toBe(5);
|
|
382
|
-
expect(subtract(5, 2)).toBe(3);
|
|
383
|
-
expect(multiply(2, 3)).toBe(999);
|
|
381
|
+
expect(add(2, 3)).toBe(5);
|
|
382
|
+
expect(subtract(5, 2)).toBe(3);
|
|
383
|
+
expect(multiply(2, 3)).toBe(999);
|
|
384
384
|
});
|
|
385
385
|
```
|
|
386
386
|
|
package/bin/cli.js
CHANGED
|
@@ -8,14 +8,13 @@ import {green, red, yellow} from "../utils/consoleColor.js";
|
|
|
8
8
|
import {getTestResultMsg} from "../utils/makeMessage.js";
|
|
9
9
|
import {RESULT_TITLE} from "../constants.js";
|
|
10
10
|
|
|
11
|
-
// 사용자 프로젝트의 module type 확인
|
|
12
11
|
const getUserModuleType = () => {
|
|
13
12
|
try {
|
|
14
13
|
const pkgPath = path.join(process.cwd(), 'package.json');
|
|
15
14
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
16
15
|
return pkg.type === 'module' ? 'esm' : 'cjs';
|
|
17
16
|
} catch {
|
|
18
|
-
return 'cjs';
|
|
17
|
+
return 'cjs';
|
|
19
18
|
}
|
|
20
19
|
};
|
|
21
20
|
|