Skip to content

Commit 4fc3933

Browse files
committedJul 27, 2018
chore: changes after GeeWee review
- re-added a removed test related to cache key - cleaned-up deps
1 parent fbe4f1f commit 4fc3933

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed
 

‎package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"clean-build": "npm run clean && npm run build",
1313
"pretest": "npm run tslint && npm run clean-build",
1414
"test": "node scripts/tests.js",
15-
"test:unit": "jest --testRegex '' --testMatch '<rootDir>/src/**/*.spec.ts'",
1615
"tslint": "tslint 'src/**/*.ts'",
1716
"doc": "doctoc .",
1817
"prepublish": "npm run clean-build",
@@ -79,6 +78,7 @@
7978
"peerDependencies": {
8079
"babel-core": "^7.0.0-0",
8180
"babel-jest": "^23.0.0",
81+
"@babel/preset-env": "^7.0.0",
8282
"jest": "^23.0.0",
8383
"typescript": "2.x"
8484
},
@@ -87,19 +87,17 @@
8787
"@babel/preset-env": "^7.0.0-beta.54",
8888
"@types/babel-core": "^6.25.5",
8989
"@types/es6-shim": "0.31.37",
90-
"@types/flat": "^0.0.28",
9190
"@types/fs-extra": "5.0.4",
9291
"@types/jest": "^23.3.0",
9392
"@types/lodash": "^4.14.109",
9493
"@types/node": "10.5.2",
9594
"@types/react": "16.4.6",
9695
"@types/yargs": "^11.0.0",
97-
"babel-plugin-istanbul": "^4.1.6",
96+
"babel-jest": "^23.4.0",
9897
"babel-preset-jest": "^23.2.0",
9998
"cross-spawn": "latest",
10099
"cross-spawn-with-kill": "latest",
101100
"doctoc": "latest",
102-
"flat": "^4.1.0",
103101
"husky": "^0.14.3",
104102
"jest": "^23.4.1",
105103
"lint-staged": "^7.1.2",

‎tests/__tests__/get-cache-key.spec.ts

+16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
import getCacheKey from '../../dist/utils/get-cache-key';
22
import cfg from '../__helpers__/jest-config';
3+
import _getTSConfig from '../../dist/utils/get-ts-config';
4+
5+
jest.mock('../../dist/utils/get-ts-config', () => {
6+
return {
7+
default: jest.fn(() => ({ foo: 'bar' })),
8+
};
9+
});
10+
11+
// type casting
12+
const getTSConfig: jest.Mock = _getTSConfig as any;
313

414
describe('getCacheKey', () => {
515
const src = 'console.log(123);';
@@ -24,6 +34,12 @@ describe('getCacheKey', () => {
2434
expect(newHash).not.toBe(originalHash);
2535
});
2636

37+
it('should change hash when tsconfig changes', () => {
38+
getTSConfig.mockImplementationOnce(() => ({ not_foo: 'not bar' }));
39+
const newHash = getCacheKey(src, filepath, configStr, options);
40+
expect(newHash).not.toBe(originalHash);
41+
});
42+
2743
it('should change hash when transform options change', () => {
2844
const newOptions = { ...options, instrument: true };
2945
const newHash = getCacheKey(src, filepath, configStr, newOptions);

‎yarn.lock

-14
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,6 @@
564564
version "0.31.37"
565565
resolved "https://registry.yarnpkg.com/@types/es6-shim/-/es6-shim-0.31.37.tgz#d01fa9b61a6692e57387dde5483b0255659ba70f"
566566

567-
"@types/flat@^0.0.28":
568-
version "0.0.28"
569-
resolved "https://registry.yarnpkg.com/@types/flat/-/flat-0.0.28.tgz#5c788149d85a6cf8ff5f5f000acdd912cdea4274"
570-
571567
"@types/fs-extra@5.0.4":
572568
version "5.0.4"
573569
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-5.0.4.tgz#b971134d162cc0497d221adde3dbb67502225599"
@@ -1902,12 +1898,6 @@ find-up@^3.0.0:
19021898
dependencies:
19031899
locate-path "^3.0.0"
19041900

1905-
flat@^4.1.0:
1906-
version "4.1.0"
1907-
resolved "https://registry.yarnpkg.com/flat/-/flat-4.1.0.tgz#090bec8b05e39cba309747f1d588f04dbaf98db2"
1908-
dependencies:
1909-
is-buffer "~2.0.3"
1910-
19111901
for-in@^1.0.1, for-in@^1.0.2:
19121902
version "1.0.2"
19131903
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
@@ -2329,10 +2319,6 @@ is-buffer@^1.1.5:
23292319
version "1.1.5"
23302320
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.5.tgz#1f3b26ef613b214b88cbca23cc6c01d87961eecc"
23312321

2332-
is-buffer@~2.0.3:
2333-
version "2.0.3"
2334-
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.3.tgz#4ecf3fcf749cbd1e472689e109ac66261a25e725"
2335-
23362322
is-builtin-module@^1.0.0:
23372323
version "1.0.0"
23382324
resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe"

0 commit comments

Comments
 (0)
Please sign in to comment.