Skip to content

Commit bc05b02

Browse files
author
Robert Jackson
authored
Merge pull request #64 from pzuraq/feat/remove-input-from-test-name
Removes `input` suffix from the path indicated during a test
2 parents 0c87c51 + b6fd83d commit bc05b02

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/test-support.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ function jscodeshiftTest(options) {
3434
.forEach(filename => {
3535
let extension = path.extname(filename);
3636
let testName = filename.replace(`.input${extension}`, '');
37+
let testInputPath = path.join(details.fixtureDir, `${testName}${extension}`);
3738
let inputPath = path.join(details.fixtureDir, `${testName}.input${extension}`);
3839
let outputPath = path.join(details.fixtureDir, `${testName}.output${extension}`);
3940
let optionsPath = path.join(details.fixtureDir, `${testName}.options.json`);
@@ -52,7 +53,7 @@ function jscodeshiftTest(options) {
5253
runInlineTest(
5354
transform,
5455
{},
55-
{ path: inputPath, source: fs.readFileSync(inputPath, 'utf8') },
56+
{ path: testInputPath, source: fs.readFileSync(inputPath, 'utf8') },
5657
fs.readFileSync(outputPath, 'utf8')
5758
);
5859
});
@@ -61,7 +62,7 @@ function jscodeshiftTest(options) {
6162
runInlineTest(
6263
transform,
6364
{},
64-
{ path: inputPath, source: fs.readFileSync(outputPath, 'utf8') },
65+
{ path: testInputPath, source: fs.readFileSync(outputPath, 'utf8') },
6566
fs.readFileSync(outputPath, 'utf8')
6667
);
6768
});

tests/cli-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ QUnit.module('codemod-cli', function(hooks) {
203203

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

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

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

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

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

0 commit comments

Comments
 (0)