formacao
This commit is contained in:
Generated
Vendored
+16
-11
@@ -30,16 +30,20 @@ const ast_helpers_1 = require("./utils/ast-helpers");
|
||||
*/
|
||||
const BLANK_LINE_PLACEHOLDER = '// __PRESERVE_BLANK_LINE__';
|
||||
/**
|
||||
* Vitest function names that should be imported when using the --add-imports option.
|
||||
* Jasmine to Vitest imports map that should be employed when the --add-imports option is used.
|
||||
*/
|
||||
const VITEST_FUNCTION_NAMES = new Set([
|
||||
'describe',
|
||||
'it',
|
||||
'expect',
|
||||
'beforeEach',
|
||||
'afterEach',
|
||||
'beforeAll',
|
||||
'afterAll',
|
||||
const JASMINE_TO_VITEST_IMPORT = new Map([
|
||||
['describe', 'describe'],
|
||||
['fdescribe', 'describe'],
|
||||
['xdescribe', 'describe'],
|
||||
['it', 'it'],
|
||||
['fit', 'it'],
|
||||
['xit', 'it'],
|
||||
['expect', 'expect'],
|
||||
['beforeEach', 'beforeEach'],
|
||||
['afterEach', 'afterEach'],
|
||||
['beforeAll', 'beforeAll'],
|
||||
['afterAll', 'afterAll'],
|
||||
]);
|
||||
/**
|
||||
* Replaces blank lines in the content with a placeholder to prevent TypeScript's printer
|
||||
@@ -144,8 +148,9 @@ function transformJasmineToVitest(filePath, content, reporter, options) {
|
||||
if (typescript_1.default.isCallExpression(transformedNode)) {
|
||||
if (options.addImports && typescript_1.default.isIdentifier(transformedNode.expression)) {
|
||||
const name = transformedNode.expression.text;
|
||||
if (VITEST_FUNCTION_NAMES.has(name)) {
|
||||
(0, ast_helpers_1.addVitestValueImport)(pendingVitestValueImports, name);
|
||||
const importSpecifierName = JASMINE_TO_VITEST_IMPORT.get(name);
|
||||
if (importSpecifierName) {
|
||||
(0, ast_helpers_1.addVitestValueImport)(pendingVitestValueImports, importSpecifierName);
|
||||
}
|
||||
}
|
||||
for (const transformer of callExpressionTransformers) {
|
||||
|
||||
Reference in New Issue
Block a user