This commit is contained in:
Kasper Peulen 2023-01-13 21:23:16 +01:00
parent 1563de352e
commit 9ea6411394
4 changed files with 7 additions and 45 deletions

View File

@ -63,8 +63,8 @@
"devDependencies": {
"@types/jscodeshift": "^0.11.6",
"jest": "^29.3.1",
"jest-serializer-ansi": "^1.0.3",
"jest-specific-snapshot": "^7.0.0",
"strip-ansi": "^7.0.1",
"typescript": "~4.9.3"
},
"publishConfig": {

View File

@ -1,7 +1,7 @@
import { describe, it, expect } from '@jest/globals';
import { dedent } from 'ts-dedent';
import type { API } from 'jscodeshift';
import noColorSerializer from 'jest-serializer-ansi';
import stripAnsi from 'strip-ansi';
import _transform from '../csf-2-to-3';
expect.addSnapshotSerializer({
@ -218,7 +218,10 @@ describe('csf-2-to-3', () => {
describe('typescript', () => {
it('should error with namespace imports', () => {
expect.addSnapshotSerializer(noColorSerializer);
expect.addSnapshotSerializer({
serialize: (value) => stripAnsi(value),
test: () => true,
});
expect(() =>
tsTransform(dedent`
import * as SB from '@storybook/react';

View File

@ -1,5 +0,0 @@
/* eslint-disable import/no-extraneous-dependencies */
declare module 'jest-serializer-ansi' {
export default import('pretty-format').Plugin;
}

View File

@ -6342,12 +6342,12 @@ __metadata:
cross-spawn: ^7.0.3
globby: ^11.0.2
jest: ^29.3.1
jest-serializer-ansi: ^1.0.3
jest-specific-snapshot: ^7.0.0
jscodeshift: ^0.13.1
lodash: ^4.17.21
prettier: ^2.8.0
recast: ^0.23.1
strip-ansi: ^7.0.1
typescript: ~4.9.3
util: ^0.12.4
languageName: unknown
@ -10266,13 +10266,6 @@ __metadata:
languageName: node
linkType: hard
"ansi-regex@npm:^3.0.0":
version: 3.0.1
resolution: "ansi-regex@npm:3.0.1"
checksum: d108a7498b8568caf4a46eea4f1784ab4e0dfb2e3f3938c697dee21443d622d765c958f2b7e2b9f6b9e55e2e2af0584eaa9915d51782b89a841c28e744e7a167
languageName: node
linkType: hard
"ansi-regex@npm:^4.1.0":
version: 4.1.1
resolution: "ansi-regex@npm:4.1.1"
@ -17023,15 +17016,6 @@ __metadata:
languageName: node
linkType: hard
"has-ansi@npm:^3.0.0":
version: 3.0.0
resolution: "has-ansi@npm:3.0.0"
dependencies:
ansi-regex: ^3.0.0
checksum: 120575cd37fbdb4553f201563448d93181f39c28aed083bc0fb1df2d0758c3aac86480e67252c05d34a9f6452503a74d3d6c6ed8fd52a554f2a7439acd8a201f
languageName: node
linkType: hard
"has-bigints@npm:^1.0.1, has-bigints@npm:^1.0.2":
version: 1.0.2
resolution: "has-bigints@npm:1.0.2"
@ -19581,17 +19565,6 @@ __metadata:
languageName: node
linkType: hard
"jest-serializer-ansi@npm:^1.0.3":
version: 1.0.3
resolution: "jest-serializer-ansi@npm:1.0.3"
dependencies:
has-ansi: ^3.0.0
lodash: ^4.17.4
strip-ansi: ^4.0.0
checksum: 4360df6ec209250bc962118bbbb7a9ab460c86fb012128af1dc44db0ae469dcf4219e30536a6122ed9a88c3863a9e10f63865ba5a8b036fff94ae1f1f7f7aa89
languageName: node
linkType: hard
"jest-serializer-html@npm:^7.1.0":
version: 7.1.0
resolution: "jest-serializer-html@npm:7.1.0"
@ -27597,15 +27570,6 @@ __metadata:
languageName: node
linkType: hard
"strip-ansi@npm:^4.0.0":
version: 4.0.0
resolution: "strip-ansi@npm:4.0.0"
dependencies:
ansi-regex: ^3.0.0
checksum: d75d9681e0637ea316ddbd7d4d3be010b1895a17e885155e0ed6a39755ae0fd7ef46e14b22162e66a62db122d3a98ab7917794e255532ab461bb0a04feb03e7d
languageName: node
linkType: hard
"strip-ansi@npm:^5.0.0, strip-ansi@npm:^5.1.0, strip-ansi@npm:^5.2.0":
version: 5.2.0
resolution: "strip-ansi@npm:5.2.0"