MCPcopy Index your code
hub / github.com/codecombat/codecombat / runTests

Method runTests

app/views/TestView.js:131–214  ·  view source on GitHub ↗
(specFiles, demosOn, view)

Source from the content-addressed store, hash-verified

129 }
130
131 static runTests (specFiles, demosOn, view) {
132 if (demosOn == null) { demosOn = false }
133 const VueTestUtils = require('@vue/test-utils')
134 const locale = require('locale/locale')
135
136 VueTestUtils.config.mocks.$t = function (text) {
137 if (text.includes('.')) {
138 const res = text.split('.')
139 return locale.en.translation[res[0]][res[1]]
140 } else {
141 return locale.en.translation[text]
142 }
143 }
144
145 jasmine.getEnv().addReporter({
146 suiteStack: [],
147
148 specDone (result) {
149 if (result.status === 'failed') {
150 const report = {
151 suiteDescriptions: _.clone(this.suiteStack),
152 failMessages: (Array.from(result.failedExpectations).map((fe) => fe.message)),
153 testDescription: result.description
154 }
155 if (view != null) {
156 view.failureReports.push(report)
157 }
158 return (view != null ? view.renderSelectors('#failure-reports') : undefined)
159 }
160 },
161
162 suiteStarted (result) {
163 return this.suiteStack.push(result.description)
164 },
165
166 suiteDone (result) {
167 return this.suiteStack.pop()
168 }
169
170 })
171
172 application.testing = true
173 if (specFiles == null) { specFiles = this.getAllSpecFiles() }
174 if (demosOn) {
175 jasmine.demoEl = _.once($el => $('#demo-area').append($el))
176 jasmine.demoModal = _.once(modal => globalVar.currentView.openModalView(modal))
177 } else {
178 jasmine.demoEl = _.noop
179 jasmine.demoModal = _.noop
180 }
181
182 jasmine.Ajax.install()
183 return describe('Client', function () {
184 beforeEach(function () {
185 me.clear()
186 me.markToRevert()
187 jasmine.Ajax.requests.reset()
188 Backbone.Mediator.init()

Callers 2

run-tests.jsFile · 0.80
afterInsertMethod · 0.80

Calls 4

getAllSpecFilesMethod · 0.95
markToRevertMethod · 0.80
resetMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected