1 | 'use strict';
|
2 | const path = require('path');
|
3 | const figures = require('figures');
|
4 | const chalk = require('../chalk').get();
|
5 |
|
6 | const SEPERATOR = ' ' + chalk.gray.dim(figures.pointerSmall) + ' ';
|
7 |
|
8 | module.exports = (base, file, title) => {
|
9 | const prefix = file
|
10 |
|
11 | .replace(base, (match, offset) => offset === 0 ? '' : match)
|
12 | .replace(/\.spec/, '')
|
13 | .replace(/\.test/, '')
|
14 | .replace(/test-/g, '')
|
15 | .replace(/\.js$/, '')
|
16 | .split(path.sep)
|
17 | .filter(p => p !== '__tests__')
|
18 | .join(SEPERATOR);
|
19 |
|
20 | return prefix + SEPERATOR + title;
|
21 | };
|