Skip to content

Commit be0ed7b

Browse files
author
Daniel Del Core
committed
fixes unit tests
1 parent 52fe62a commit be0ed7b

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

jest.config.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ module.exports = {
2626
'jest-watch-typeahead/testname',
2727
],
2828
moduleNameMapper: {
29-
// '@hypermod/(.*)\\.js': '<rootDir>/packages/$1/src',
3029
'(.+)\\.js$': '$1',
31-
3230
'@hypermod/(.*)$': '<rootDir>/packages/$1/src',
3331
'@codeshift/(.*)$': '<rootDir>/packages/$1/src',
3432
},

packages/fetcher/src/index.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('fetcher', () => {
1919
let mockMatchedPaths: string[] = [];
2020

2121
beforeEach(() => {
22-
mockMatchedPaths = [path.join(mockBasePath, 'hypermod.config.js')];
22+
mockMatchedPaths = [path.join(mockBasePath, 'hypermod.config.ts')];
2323

2424
(globby as unknown as jest.Mock).mockImplementation(() =>
2525
Promise.resolve(mockMatchedPaths),
@@ -34,10 +34,10 @@ describe('fetcher', () => {
3434

3535
describe('fetchConfig', () => {
3636
it('fetches config with default export', async () => {
37-
const mockFilePath = `${__dirname}/path/to/hypermod.config.js`;
37+
const mockFilePath = `${__dirname}/path/to/hypermod.config.ts`;
3838

3939
jest.mock(
40-
`${__dirname}/path/to/hypermod.config.js`,
40+
`${__dirname}/path/to/hypermod.config.ts`,
4141
() => ({ __esModule: true, default: mockConfig }),
4242
{ virtual: true },
4343
);
@@ -50,7 +50,7 @@ describe('fetcher', () => {
5050

5151
it('fetches config with named export', async () => {
5252
jest.mock(
53-
path.join(mockBasePath, 'hypermod.config.js'),
53+
path.join(mockBasePath, 'hypermod.config.ts'),
5454
() => mockConfig,
5555
{
5656
virtual: true,
@@ -61,7 +61,7 @@ describe('fetcher', () => {
6161

6262
expect(configMeta!.config).toEqual(mockConfig);
6363
expect(configMeta!.filePath).toEqual(
64-
path.join(mockBasePath, 'hypermod.config.js'),
64+
path.join(mockBasePath, 'hypermod.config.ts'),
6565
);
6666
});
6767

@@ -102,7 +102,7 @@ describe('fetcher', () => {
102102

103103
describe('fetchPackage', () => {
104104
it('correctly fetches package and returns a config', async () => {
105-
const mockFilePath = 'path/to/config.hypermod.js';
105+
const mockFilePath = 'path/to/config.hypermod.ts';
106106
const mockPackageManager = {
107107
install: jest.fn(),
108108
getInfo: jest.fn().mockReturnValue({ location: mockFilePath }),
@@ -155,7 +155,7 @@ describe('fetcher', () => {
155155

156156
expect(configMeta!.config).toEqual(mockConfig);
157157
expect(configMeta!.filePath).toEqual(
158-
mockBasePath + '/hypermod.config.js',
158+
mockBasePath + '/hypermod.config.ts',
159159
);
160160
});
161161

0 commit comments

Comments
 (0)