Skip to content
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

Ignore empty fixture directories and fix fixtures in the parser #9113

Merged
merged 3 commits into from Dec 3, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
21 changes: 17 additions & 4 deletions packages/babel-helper-fixtures/src/index.js
Expand Up @@ -70,7 +70,7 @@ function findFile(filepath: string, allowJSON: boolean) {
throw new Error(`Found conflicting file matches: ${matches.join(", ")}`);
}

return matches[0] || filepath + ".js";
return matches[0];
}

export default function get(entryLoc): Array<Suite> {
Expand Down Expand Up @@ -101,18 +101,31 @@ export default function get(entryLoc): Array<Suite> {
}

function push(taskName, taskDir) {
const actualLoc = findFile(taskDir + "/input");
const expectLoc = findFile(taskDir + "/output", true /* allowJSON */);
const taskDirStats = fs.statSync(taskDir);
let actualLoc = findFile(taskDir + "/input");
let execLoc = findFile(taskDir + "/exec");

// If neither input nor exec is present it is not a real testcase
if (taskDirStats.isDirectory() && !actualLoc && !execLoc) {
return;
danez marked this conversation as resolved.
Show resolved Hide resolved
} else if (!actualLoc) {
actualLoc = taskDir + "/input.js";
} else if (!execLoc) {
execLoc = taskDir + "/exec.js";
}

const expectLoc =
findFile(taskDir + "/output", true /* allowJSON */) ||
taskDir + "/output.js";

const actualLocAlias =
suiteName + "/" + taskName + "/" + path.basename(actualLoc);
const expectLocAlias =
suiteName + "/" + taskName + "/" + path.basename(actualLoc);
let execLocAlias =
suiteName + "/" + taskName + "/" + path.basename(actualLoc);

if (fs.statSync(taskDir).isFile()) {
if (taskDirStats.isFile()) {
const ext = path.extname(taskDir);
if (EXTENSIONS.indexOf(ext) === -1) return;

Expand Down