mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Add definitions for jscodeshift/src/testUtils (#36154)
* Add defns for testUtils module * Import unecessary here, use a reference path instead * Add testUtils.d.ts to files array instead of reference
This commit is contained in:
committed by
Daniel Rosenwasser
parent
4a4cf23ff4
commit
e7b5b2048a
1
types/jscodeshift/index.d.ts
vendored
1
types/jscodeshift/index.d.ts
vendored
@@ -1,6 +1,7 @@
|
||||
// Type definitions for jscodeshift 0.6
|
||||
// Project: https://github.com/facebook/jscodeshift#readme
|
||||
// Definitions by: Brie Bunge <https://github.com/brieb>
|
||||
// Brian Jacobel <https://github.com/bjacobel>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.9
|
||||
|
||||
|
||||
6
types/jscodeshift/src/testUtils.d.ts
vendored
Normal file
6
types/jscodeshift/src/testUtils.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export function defineTest(
|
||||
dirName: string,
|
||||
transformName: string,
|
||||
options: any,
|
||||
testFilePrefix?: string
|
||||
): () => any;
|
||||
@@ -1,4 +1,5 @@
|
||||
import { ASTNode, FileInfo, API, Transform, Parser } from "jscodeshift";
|
||||
import * as testUtils from "jscodeshift/src/testUtils";
|
||||
|
||||
// Can define transform with `function`.
|
||||
function replaceWithFooTransform(fileInfo: FileInfo, api: API) {
|
||||
@@ -73,3 +74,10 @@ const transformWithRecastParseOptions: Transform = (file, { j }) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Can define a test
|
||||
testUtils.defineTest(
|
||||
"directory",
|
||||
"transformName",
|
||||
{ opt: true },
|
||||
);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
"src/collections/Node.d.ts",
|
||||
"src/collections/VariableDeclarator.d.ts",
|
||||
"src/template.d.ts",
|
||||
"src/testUtils.d.ts",
|
||||
"test/jscodeshift-tests.ts",
|
||||
"test/js-transforms/bind-this-to-bind-expression.ts",
|
||||
"test/js-transforms/call-expression-bind-this-to-arrow-function-expression.ts",
|
||||
|
||||
Reference in New Issue
Block a user