Skip to content

Commit

Permalink
chore: use jest-snapshot-serializer-raw/always as unquoteSerializer (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey authored Apr 25, 2021
1 parent 59ef5c4 commit 31a179d
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 16 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
"homepage": "https://github.com/kentcdodds/kcd-scripts#readme",
"devDependencies": {
"jest-in-case": "^1.0.2",
"jest-snapshot-serializer-raw": "^1.2.0",
"slash": "^3.0.0"
}
}
2 changes: 1 addition & 1 deletion src/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path'
import slash from 'slash'
import cases from 'jest-in-case'
import {unquoteSerializer} from '../scripts/__tests__/helpers/serializers'
import * as unquoteSerializer from 'jest-snapshot-serializer-raw/always'

const projectRoot = path.join(__dirname, '../../')

Expand Down
4 changes: 3 additions & 1 deletion src/scripts/__tests__/format.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import cases from 'jest-in-case'
import {unquoteSerializer, winPathSerializer} from './helpers/serializers'
import * as unquoteSerializer from 'jest-snapshot-serializer-raw/always'

import {winPathSerializer} from './helpers/serializers'

expect.addSnapshotSerializer(unquoteSerializer)
expect.addSnapshotSerializer(winPathSerializer)
Expand Down
6 changes: 0 additions & 6 deletions src/scripts/__tests__/helpers/serializers.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import slash from 'slash'

// this removes the quotes around strings...
export const unquoteSerializer = {
print: val => val,
test: val => typeof val === 'string',
}

// this converts windows style file paths to unix...
export const winPathSerializer = {
print: val => slash(val),
Expand Down
8 changes: 3 additions & 5 deletions src/scripts/__tests__/lint.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import cases from 'jest-in-case'
import {
unquoteSerializer,
winPathSerializer,
relativePathSerializer,
} from './helpers/serializers'
import * as unquoteSerializer from 'jest-snapshot-serializer-raw/always'

import {winPathSerializer, relativePathSerializer} from './helpers/serializers'

expect.addSnapshotSerializer(unquoteSerializer)
expect.addSnapshotSerializer(winPathSerializer)
Expand Down
4 changes: 3 additions & 1 deletion src/scripts/__tests__/precommit.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import cases from 'jest-in-case'
import {unquoteSerializer, winPathSerializer} from './helpers/serializers'
import * as unquoteSerializer from 'jest-snapshot-serializer-raw/always'

import {winPathSerializer} from './helpers/serializers'

expect.addSnapshotSerializer(unquoteSerializer)
expect.addSnapshotSerializer(winPathSerializer)
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/__tests__/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cases from 'jest-in-case'
import {unquoteSerializer} from './helpers/serializers'
import * as unquoteSerializer from 'jest-snapshot-serializer-raw/always'

jest.mock('jest', () => ({run: jest.fn()}))
jest.mock('../../config/jest.config', () => ({builtInConfig: true}))
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/__tests__/validate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cases from 'jest-in-case'
import {unquoteSerializer} from './helpers/serializers'
import * as unquoteSerializer from 'jest-snapshot-serializer-raw/always'

expect.addSnapshotSerializer(unquoteSerializer)

Expand Down

0 comments on commit 31a179d

Please sign in to comment.