Detalhes do pacote

@codeshift/test-utils

CodeshiftCommunity31.3kMIT0.3.2

applyTransform

readme (leia-me)

@codeshift/test-utils

applyTransform

Accepts a transform and a code string and runs the transform against it.

Works well with Jest's toMatchInlineSnapshot and toMatchSnapshot assetions.

Example:

it('should wrap avatar in a tooltip', () => {
  const result = applyTransform(
    transformer,
    `
      import Avatar from '@atlaskit/avatar';

      const App = () => {
        return <Avatar name="foo" />;
      }
    `,
    { parser: 'tsx' },
  );

  expect(result).toMatchInlineSnapshot(`
    "import Tooltip from '@atlaskit/tooltip';
      import Avatar from '@atlaskit/avatar';

      const App = () => {
        return <Tooltip content=\\"foo\\"><Avatar name=\\"foo\\" /></Tooltip>;
      }"
  `);
});

changelog (log de mudanças)

@codeshift/test-utils

0.3.2

Patch Changes

  • 4d55055: Parcel now bundles these deps with a Node target

0.3.1

Patch Changes

  • 8255eb2: Packages are now built with pareljs. Entrypoints have been updated to match

0.3.0

Minor Changes

  • 6e5fa3d: Allows to use an FileInfo in the applyTransform test util

0.2.0

Minor Changes

  • 8a8517c: applyTransfrom now returns a promise to support async transforms

0.1.4

Patch Changes

  • e776f9c: Fixes colors.js vulnrability by bumping jscodeshift

0.1.3

Patch Changes

  • caaaf9a: Locks version of colors.js to avoid vulnrability

0.1.2

Patch Changes

  • e8cf76e: Releasing all packages to fix version mismatch

0.1.1

Patch Changes

  • 473473e: Renames runTransform to applyTransform