From d154be6e4e01232b71b222da3436cd30c2587b4f Mon Sep 17 00:00:00 2001 From: jankuca Date: Sun, 15 Nov 2015 20:48:49 +0100 Subject: [PATCH] add support for *.spec.js file naming --- cli.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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) {