Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions src/test-support.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function jscodeshiftTest(options) {
.forEach(filename => {
let extension = path.extname(filename);
let testName = filename.replace(`.input${extension}`, '');
let testInputPath = path.join(details.fixtureDir, `${testName}${extension}`);
let inputPath = path.join(details.fixtureDir, `${testName}.input${extension}`);
let outputPath = path.join(details.fixtureDir, `${testName}.output${extension}`);
let optionsPath = path.join(details.fixtureDir, `${testName}.options.json`);
Expand All @@ -52,7 +53,7 @@ function jscodeshiftTest(options) {
runInlineTest(
transform,
{},
{ path: inputPath, source: fs.readFileSync(inputPath, 'utf8') },
{ path: testInputPath, source: fs.readFileSync(inputPath, 'utf8') },
fs.readFileSync(outputPath, 'utf8')
);
});
Expand All @@ -61,7 +62,7 @@ function jscodeshiftTest(options) {
runInlineTest(
transform,
{},
{ path: inputPath, source: fs.readFileSync(outputPath, 'utf8') },
{ path: testInputPath, source: fs.readFileSync(outputPath, 'utf8') },
fs.readFileSync(outputPath, 'utf8')
);
});
Expand Down
4 changes: 2 additions & 2 deletions tests/cli-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ QUnit.module('codemod-cli', function(hooks) {

QUnit.test('transform should receive a file path in tests', async function(assert) {
const realCodemodProjectPath = fs.realpathSync(codemodProject.path());
const expectedPath = `${realCodemodProjectPath}/transforms/main/__testfixtures__/basic.input.js`;
const expectedPath = `${realCodemodProjectPath}/transforms/main/__testfixtures__/basic.js`;

await execa(EXECUTABLE_PATH, ['generate', 'codemod', 'main']);

Expand Down Expand Up @@ -240,7 +240,7 @@ QUnit.module('codemod-cli', function(hooks) {

QUnit.test('transform should receive a subfolder file path in tests', async function(assert) {
const realCodemodProjectPath = fs.realpathSync(codemodProject.path());
const expectedPath = `${realCodemodProjectPath}/transforms/main/__testfixtures__/foo/basic.input.js`;
const expectedPath = `${realCodemodProjectPath}/transforms/main/__testfixtures__/foo/basic.js`;

await execa(EXECUTABLE_PATH, ['generate', 'codemod', 'main']);

Expand Down