Skip to content

Commit

Permalink
it.todo
Browse files Browse the repository at this point in the history
  • Loading branch information
bennycode committed Oct 25, 2024
1 parent b80e71b commit 3f2e69d
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 11 deletions.
11 changes: 8 additions & 3 deletions src/converter/convertFile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@ import path from 'node:path';
import {ProjectUtil} from '../util/ProjectUtil.js';
import {convertFile} from './convertFile.js';

describe('convertFile', () => {
describe.only('convertFile', () => {
const fixtures = path.join(process.cwd(), 'src', 'test', 'fixtures');

it('fixes imports from index files', async () => {
const projectDir = path.join(fixtures, 'index-import');
const projectConfig = path.join(projectDir, 'tsconfig.json');
const snapshot = path.join(projectDir, 'main.snap.ts');
const snapshot = path.join(projectDir, 'src', 'main.snap.ts');
const project = ProjectUtil.getProject(projectConfig);
const modifiedFile = convertFile(project, project.getSourceFile('main.ts')!, true);

const sourceFile = project.getSourceFile('main.ts')!;
const modifiedFile = convertFile(project, sourceFile, true);

await expect(modifiedFile.getText()).toMatchFileSnapshot(snapshot);
});

it.todo('fixes imports when tsconfig has an "include" property');
});
2 changes: 1 addition & 1 deletion src/test/fixtures/index-import/main.snap.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import {MY_CONSTANT} from './src/index.js';
import {MY_CONSTANT} from './src/index';

console.log(MY_CONSTANT);
3 changes: 0 additions & 3 deletions src/test/fixtures/index-import/main.ts

This file was deleted.

File renamed without changes.
3 changes: 3 additions & 0 deletions src/test/fixtures/index-import/src/main.snap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import {MY_CONSTANT} from './lib/index.js';

console.log(MY_CONSTANT);
4 changes: 4 additions & 0 deletions src/test/fixtures/index-import/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @ts-ignore
import {MY_CONSTANT} from './lib';

console.log(MY_CONSTANT);
2 changes: 1 addition & 1 deletion src/test/fixtures/tsconfig-include/consumer.snap.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import {MY_CONSTANT} from './src/producer';
import {MY_CONSTANT} from './lib/producer.js';

console.log(MY_CONSTANT);
3 changes: 0 additions & 3 deletions src/test/fixtures/tsconfig-include/consumer.ts

This file was deleted.

3 changes: 3 additions & 0 deletions src/test/fixtures/tsconfig-include/src/consumer.snap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import {MY_CONSTANT} from './lib/producer.js';

console.log(MY_CONSTANT);
4 changes: 4 additions & 0 deletions src/test/fixtures/tsconfig-include/src/consumer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @ts-ignore
import {MY_CONSTANT} from './lib/producer';

console.log(MY_CONSTANT);

0 comments on commit 3f2e69d

Please sign in to comment.