diff --git a/cli.js b/cli.js index 2029410ce..616dcf6d6 100755 --- a/cli.js +++ b/cli.js @@ -64,9 +64,16 @@ function prefixTitle(file) { base += path.sep; var prefix = path.relative(process.cwd(), file) - .replace(/test\-/g, '') + .replace(base, ''); + + if (/\.spec\./.test(prefix)) { + prefix = prefix.replace(/\.spec\./, '.'); + } else { + prefix = prefix.replace(/test\-/g, ''); + } + + prefix = prefix .replace(/\.js$/, '') - .replace(base, '') .split(path.sep).join(separator); if (prefix.length > 0) {