Skip to content

Commit

Permalink
test: use jest-snapshot-serializer-raw/always in all tests (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey authored Apr 25, 2021
1 parent 31a179d commit 17ddc27
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 38 deletions.
11 changes: 8 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
const {jest: jestConfig} = require('./src/config')
const {jest} = require('./src/config')

module.exports = Object.assign(jestConfig, {
module.exports = {
...jest,
coverageThreshold: null,
})
snapshotSerializers: [
...jest.snapshotSerializers,
'jest-snapshot-serializer-raw/always',
],
}
42 changes: 21 additions & 21 deletions src/__tests__/__snapshots__/utils.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@

exports[`getConcurrentlyArgs gives good args to pass to concurrently 1`] = `
Array [
"--kill-others-on-fail",
"--prefix",
"[{name}]",
"--names",
"build,lint,test,validate,a,b,c,d,e,f,g,h,i,j",
"--prefix-colors",
"bgBlue.bold.white,bgGreen.bold.white,bgMagenta.bold.white,bgCyan.bold.white,bgWhite.bold.white,bgRed.bold.white,bgBlack.bold.white,bgYellow.bold.white,bgBlue.bold.white,bgGreen.bold.white,bgMagenta.bold.white,bgCyan.bold.white,bgWhite.bold.white,bgRed.bold.white",
"\\"echo build\\"",
"\\"echo lint\\"",
"\\"echo test\\"",
"\\"echo validate\\"",
"\\"echo a\\"",
"\\"echo b\\"",
"\\"echo c\\"",
"\\"echo d\\"",
"\\"echo e\\"",
"\\"echo f\\"",
"\\"echo g\\"",
"\\"echo h\\"",
"\\"echo i\\"",
"\\"echo j\\"",
--kill-others-on-fail,
--prefix,
[{name}],
--names,
build,lint,test,validate,a,b,c,d,e,f,g,h,i,j,
--prefix-colors,
bgBlue.bold.white,bgGreen.bold.white,bgMagenta.bold.white,bgCyan.bold.white,bgWhite.bold.white,bgRed.bold.white,bgBlack.bold.white,bgYellow.bold.white,bgBlue.bold.white,bgGreen.bold.white,bgMagenta.bold.white,bgCyan.bold.white,bgWhite.bold.white,bgRed.bold.white,
"echo build",
"echo lint",
"echo test",
"echo validate",
"echo a",
"echo b",
"echo c",
"echo d",
"echo e",
"echo f",
"echo g",
"echo h",
"echo i",
"echo j",
]
`;
2 changes: 0 additions & 2 deletions src/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import path from 'path'
import slash from 'slash'
import cases from 'jest-in-case'
import * as unquoteSerializer from 'jest-snapshot-serializer-raw/always'

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

expect.addSnapshotSerializer(unquoteSerializer)
expect.addSnapshotSerializer({
print: val => slash(val.replace(projectRoot, '<PROJECT_ROOT>/')),
test: val => typeof val === 'string' && val.includes(projectRoot),
Expand Down
2 changes: 0 additions & 2 deletions src/scripts/__tests__/format.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import cases from 'jest-in-case'
import * as unquoteSerializer from 'jest-snapshot-serializer-raw/always'

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

expect.addSnapshotSerializer(unquoteSerializer)
expect.addSnapshotSerializer(winPathSerializer)

cases(
Expand Down
2 changes: 0 additions & 2 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 * as unquoteSerializer from 'jest-snapshot-serializer-raw/always'

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

expect.addSnapshotSerializer(unquoteSerializer)
expect.addSnapshotSerializer(winPathSerializer)
expect.addSnapshotSerializer(relativePathSerializer)

Expand Down
2 changes: 0 additions & 2 deletions src/scripts/__tests__/precommit.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import cases from 'jest-in-case'
import * as unquoteSerializer from 'jest-snapshot-serializer-raw/always'

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

expect.addSnapshotSerializer(unquoteSerializer)
expect.addSnapshotSerializer(winPathSerializer)

cases(
Expand Down
3 changes: 0 additions & 3 deletions src/scripts/__tests__/test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import cases from 'jest-in-case'
import * as unquoteSerializer from 'jest-snapshot-serializer-raw/always'

jest.mock('jest', () => ({run: jest.fn()}))
jest.mock('../../config/jest.config', () => ({builtInConfig: true}))
let mockIsCI = false
jest.mock('is-ci', () => mockIsCI)

expect.addSnapshotSerializer(unquoteSerializer)

cases(
'test',
({
Expand Down
3 changes: 0 additions & 3 deletions src/scripts/__tests__/validate.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import cases from 'jest-in-case'
import * as unquoteSerializer from 'jest-snapshot-serializer-raw/always'

expect.addSnapshotSerializer(unquoteSerializer)

cases(
'validate',
Expand Down

0 comments on commit 17ddc27

Please sign in to comment.