-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Group inline snapshot transform results by env (#118)
* Group inline snapshot transform results by env * Prefix env list with BABEL_ENV
- Loading branch information
1 parent
a401937
commit be57960
Showing
10 changed files
with
109 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export default function groupBy<T, K>(items: T[], iteratee: (item: T) => K): Map<K, T[]> { | ||
const groups = new Map<K, T[]>() | ||
|
||
items.forEach((item) => { | ||
const key = iteratee(item) | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
if (groups.has(key)) groups.get(key)!.push(item) | ||
else groups.set(key, [item]) | ||
}) | ||
|
||
return groups | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import {format, resolveConfig} from 'prettier' | ||
|
||
const prettierConfig = resolveConfig.sync(__dirname) | ||
if (!prettierConfig) throw new Error() | ||
|
||
module.exports = { | ||
test: (val: string) => typeof val === 'string', | ||
serialize: (val: string) => format(val, {...prettierConfig, parser: 'babel'}).trim(), | ||
serialize: (val: string) => val, | ||
} | ||
|
||
export {} |
Oops, something went wrong.