Skip to content

Commit

Permalink
🔨 Rename test utility
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldelcore committed May 18, 2021
1 parent 6dcd169 commit 473473e
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 13 deletions.
10 changes: 5 additions & 5 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://unpkg.com/@changesets/config@1.0.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"access": "public",
"baseBranch": "master"
"$schema": "https://unpkg.com/@changesets/config@1.0.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"access": "public",
"baseBranch": "main"
}
6 changes: 6 additions & 0 deletions .changeset/three-islands-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@codeshift/cli': patch
'@codeshift/utils': patch
---

Minor internal tweaks
5 changes: 5 additions & 0 deletions .changeset/young-plums-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@codeshift/test-utils': patch
---

Renames runTransform to applyTransform
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
jest.autoMockOff();

import { runTransform } from '@codeshift/test-utils';
import { applyTransform } from '@codeshift/test-utils';
import * as transformer from '../transform';

const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;

describe('Update Avatar props', () => {
it('should wrap avatar in a tooltip if name is defined', () => {
const result = runTransform(
const result = applyTransform(
transformer,
`
import Avatar from '@atlaskit/avatar';
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Options
--help, 😱
Examples
# Run all transforms for "@atlaskit/button" greater than version 3.0.0 and @atlaskit/range greater than 4.0.0
$ npx @codeshift/cli --packages @atlaskit/button@3.0.0,@atlaskit/range@4.0.0 /project/src
# Run all transforms for "@mylib/button" greater than version 3.0.0 and @mylib/range greater than 4.0.0
$ npx @codeshift/cli --packages @mylib/button@3.0.0,@mylib/range@4.0.0 /project/src
# Run the "my-custom-transform" transform of the "button" package
$ npx @codeshift/cli -t my-custom-transform /project/src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface Options {
parser?: Parser;
}

export default function runTransform(
export default function applyTransform(
transform: any,
input: string,
options: Options = {
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default as runTransform } from './run-transform';
export { default as applyTransform } from './apply-transform';
4 changes: 2 additions & 2 deletions packages/utils/src/module-imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export function hasImportDeclaration(
export function getImportDeclaration(
j: core.JSCodeshift,
source: ReturnType<typeof j>,
specifier: string,
importPath: string,
) {
return source
.find(j.ImportDeclaration)
.filter(path => path.node.source.value === specifier);
.filter(path => path.node.source.value === importPath);
}

export function getDefaultImportSpecifier(
Expand Down

0 comments on commit 473473e

Please sign in to comment.