Skip to content

fix: resolve TypeScript and Jest test issues in transform tests #333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: fix use-context-hook test file error
  • Loading branch information
amirabbas-gh committed Apr 2, 2025
commit ce94669574425f12ad5e61dcec501530b6415cb9
55 changes: 19 additions & 36 deletions transforms/__tests__/use-context-hook.test.ts
Original file line number Diff line number Diff line change
@@ -1,58 +1,41 @@
"use strict";

'use strict';

const tsTests = [
'use-context',
'use-context-2',
'any-use-context',
];
const tsTests = ["use-context", "use-context-2", "any-use-context"];

const jsTests = [
'use-context',
'use-context-2',
'any-use-context',
'mixed-import'
]

const defineTest = require('jscodeshift/dist/testUtils').defineTest;
"use-context",
"use-context-2",
"any-use-context",
"mixed-import",
];

describe('use-context-hook', () => {
const defineTest = require("jscodeshift/dist/testUtils").defineTest;

jsTests.forEach(test =>
defineTest(
__dirname,
'use-context-hook',
null,
`use-context-hook/${ test }`
)
describe("use-context-hook", () => {
jsTests.forEach((test) =>
defineTest(__dirname, "use-context-hook", null, `use-context-hook/${test}`)
);


describe('typescript', () => {

describe("typescript", () => {
beforeEach(() => {
jest.mock('../use-context-hook', () => {
return Object.assign(
require.requireActual('../use-context-hook'),
{
parser: 'tsx'
}
);
jest.mock("../use-context-hook", () => {
return Object.assign(jest.requireActual("../use-context-hook"), {
parser: "tsx",
});
});
});

afterEach(() => {
jest.resetModules();
});

tsTests.forEach(test => {
tsTests.forEach((test) => {
defineTest(
__dirname,
'use-context-hook',
"use-context-hook",
null,
`use-context-hook/typescript/${ test }`
`use-context-hook/typescript/${test}`
);
});

});
});
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy