diff options
author | winh <winnie@gitlab.com> | 2017-05-22 12:05:50 +0200 |
---|---|---|
committer | winh <winnie@gitlab.com> | 2017-05-22 13:32:35 +0200 |
commit | 1ed99ea9fad93387892ee5bde7bc8a9e42de2a47 (patch) | |
tree | 56a9a225ef8b5fb2c5a1bd257c85e48f15fe49c2 | |
parent | e15aee2b51e4f03972fba490e2974a761acccf6c (diff) | |
download | gitlab-ce-winh-karma-filenames.tar.gz |
Add file names to Karma suite descriptions (!11597)winh-karma-filenames
-rw-r--r-- | spec/javascripts/test_bundle.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/javascripts/test_bundle.js b/spec/javascripts/test_bundle.js index 0464b5d2329..3b6c16adb65 100644 --- a/spec/javascripts/test_bundle.js +++ b/spec/javascripts/test_bundle.js @@ -14,10 +14,25 @@ window.gl = window.gl || {}; window.gl.TEST_HOST = 'http://test.host'; window.gon = window.gon || {}; +class PatchedSuite extends jasmine.Suite { + constructor(attrs) { + super(Object.assign(attrs, { + description: PatchedSuite.appendFileName(attrs.description), + })); + } + + static appendFileName(description) { + return `${description} (${PatchedSuite.currentFileName})`; + } +} + +jasmine.Suite = PatchedSuite; + // render all of our tests const testsContext = require.context('.', true, /_spec$/); testsContext.keys().forEach(function (path) { try { + PatchedSuite.currentFileName = path.replace(/^\.\//, 'spec/javascripts/'); testsContext(path); } catch (err) { console.error('[ERROR] Unable to load spec: ', path); |