diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/decorate_mocha_ui.js b/packages/kbn-test/src/functional_test_runner/lib/mocha/decorate_mocha_ui.js index 9a1451c6471ef3..1cac852a7e7130 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/mocha/decorate_mocha_ui.js +++ b/packages/kbn-test/src/functional_test_runner/lib/mocha/decorate_mocha_ui.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { sep } from 'path'; +import { relative } from 'path'; import { REPO_ROOT } from '@kbn/dev-utils'; import { createAssignmentProxy } from './assignment_proxy'; import { wrapFunction } from './wrap_function'; @@ -66,7 +66,7 @@ export function decorateMochaUi(lifecycle, context) { this._tags = [].concat(this._tags || [], tags); }; - const relativeFilePath = this.file.replace(REPO_ROOT + sep, ''); + const relativeFilePath = relative(REPO_ROOT, this.file); this.tags(relativeFilePath); this.suiteTag = relativeFilePath; // The tag that uniquely targets this suite/file