Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jest snapshot - TS migration #7899

Merged
merged 37 commits into from Feb 16, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
0ecbf42
WIP - migration to ts (part 1)
doniyor2109 Feb 14, 2019
7a181dc
Remove old snapshots
doniyor2109 Feb 14, 2019
60c07cd
Merge remote-tracking branch 'jest/master' into jest-snapshot/ts_migr…
doniyor2109 Feb 14, 2019
f12de38
Use MatcherState type from expect (not implemented yet)
doniyor2109 Feb 14, 2019
1c70f23
Handle when line and column are zero
doniyor2109 Feb 14, 2019
934b93c
Remove extra exports
doniyor2109 Feb 14, 2019
b94d602
Minor tweaks
doniyor2109 Feb 15, 2019
7dc5065
Small tweaks
SimenB Feb 15, 2019
b6522be
Small tweaks
doniyor2109 Feb 15, 2019
27837ec
Revert underscores
doniyor2109 Feb 15, 2019
c7991d8
Private methods
doniyor2109 Feb 15, 2019
6cd97aa
Minor tweaks
doniyor2109 Feb 15, 2019
cdb6096
Meaningful name
SimenB Feb 15, 2019
5706125
Remove extra ts-ignore
doniyor2109 Feb 15, 2019
835974d
Small change
SimenB Feb 15, 2019
e6b14dc
Migrate tests to es modules
doniyor2109 Feb 15, 2019
d0f3789
Small tweak
doniyor2109 Feb 15, 2019
81cec4a
Eslint fixes
doniyor2109 Feb 15, 2019
9c16d91
Fix `import =` is not supported in test
doniyor2109 Feb 15, 2019
36d32f3
Remove extra dep
doniyor2109 Feb 15, 2019
1fb3194
Add Frame type to jest-message-util
doniyor2109 Feb 15, 2019
84ae5ca
Minor tweaks
doniyor2109 Feb 15, 2019
4a14bc4
Better types
SimenB Feb 15, 2019
caf2268
Minor tweaks
doniyor2109 Feb 15, 2019
1202434
Fix Frame types in tests
doniyor2109 Feb 15, 2019
cc59272
Resolve unused vars
doniyor2109 Feb 15, 2019
3c906c3
es imports
doniyor2109 Feb 15, 2019
9bd4eb0
Added package.json types
doniyor2109 Feb 16, 2019
3de88c4
Added @types/natural-comapre
doniyor2109 Feb 16, 2019
bb89663
Merge branch 'master' into jest-snapshot/ts_migration
SimenB Feb 16, 2019
186194e
fix type import
SimenB Feb 16, 2019
9288a1d
remove unused eslint supression comment
SimenB Feb 16, 2019
19aa286
chore: add missing copyright header
SimenB Feb 16, 2019
d9e9314
tweak some types
SimenB Feb 16, 2019
7590af9
explicit export
SimenB Feb 16, 2019
b915c81
changelog
SimenB Feb 16, 2019
2a8795e
prettify tsconfig
SimenB Feb 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/jest-snapshot/dts/natural-compare.d.ts
@@ -1,3 +1,4 @@
// TODO Replace with @types/natural-compare when it is merged https://github.com/DefinitelyTyped/DefinitelyTyped/pull/33084
declare module 'natural-compare' {
doniyor2109 marked this conversation as resolved.
Show resolved Hide resolved
SimenB marked this conversation as resolved.
Show resolved Hide resolved
const NaturalCompare: (a: string, b: string) => number;
export default NaturalCompare;
Expand Down
3 changes: 3 additions & 0 deletions packages/jest-snapshot/package.json
Expand Up @@ -21,6 +21,9 @@
"pretty-format": "^24.0.0",
"semver": "^5.5.0"
},
"peerDependencies": {
"jest-haste-map": "^24.0.0"
doniyor2109 marked this conversation as resolved.
Show resolved Hide resolved
},
"devDependencies": {
"@types/mkdirp": "^0.5.2",
"@types/prettier": "^1.16.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-snapshot/src/index.ts
Expand Up @@ -8,7 +8,7 @@

import fs from 'fs';
import {Config, MatcherState} from '@jest/types';
import {FS as HasteFS} from 'jest-haste-map'; // eslint-disable-line import/no-extraneous-dependencies
import {FS as HasteFS} from 'jest-haste-map';

import diff from 'jest-diff';
import {EXPECTED_COLOR, matcherHint, RECEIVED_COLOR} from 'jest-matcher-utils';
Expand Down
3 changes: 1 addition & 2 deletions packages/jest-snapshot/src/snapshot_resolver.ts
Expand Up @@ -20,8 +20,7 @@ export const buildSnapshotResolver = (
if (!cache.has(key)) {
cache.set(key, createSnapshotResolver(config.snapshotResolver));
}
// @ts-ignore
return cache.get(key);
return cache.get(key)!;
};

function createSnapshotResolver(
Expand Down
8 changes: 7 additions & 1 deletion packages/jest-snapshot/src/types.ts
@@ -1,4 +1,10 @@
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/

import {Config} from '@jest/types';

Expand Down