MCPcopy
hub / github.com/js-cookie/js-cookie / run

Function run

test/browserstack/runner.js:54–134  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

52}
53
54async function run() {
55 let driver
56
57 try {
58 driver = await new Builder().build()
59 await driver.get(TEST_URL)
60
61 await driver.wait(async () => {
62 return driver.executeScript(
63 'return Boolean(window.__qunitJsReporter && window.__qunitJsReporter.suite)'
64 )
65 }, TEST_TIMEOUT_MS)
66
67 const report = await driver.executeScript(`
68 return (function () {
69 if (!window.__qunitJsReporter || !window.__qunitJsReporter.suite) {
70 return null
71 }
72
73 var suite = window.__qunitJsReporter.suite
74 var tests = (window.__qunitJsReporter.tests || []).map(function (test) {
75 return {
76 fullName: test.fullName || [test.name || 'Unnamed test'],
77 status: test.status,
78 errors: (test.errors || []).map(function (error) {
79 return {
80 message: error && error.message ? error.message : ''
81 }
82 })
83 }
84 })
85
86 return {
87 status: suite.status,
88 testCounts: suite.testCounts || {},
89 tests: tests
90 }
91 })()
92 `)
93
94 if (!report) {
95 throw new Error(
96 'QUnit js-reporters results were not found on the test page'
97 )
98 }
99
100 const summary = getSummary(report)
101 if (summary.failed > 0 || report.status !== 'passed') {
102 const failedTests = getFailedTests(report.tests).join('\n')
103 const reason = `${summary.failed}/${summary.total} tests failed`
104
105 await setSessionStatus(driver, 'failed', reason)
106 throw new Error([reason, failedTests].filter(Boolean).join('\n'))
107 }
108
109 const platform = BrowserStackSdk.getCurrentPlatform()
110 const testInstance = platform.os
111 ? `${platform.browserName} ${platform.browserVersion}, ${platform.os} ${platform.osVersion}`

Callers 1

runner.jsFile · 0.85

Calls 3

getSummaryFunction · 0.85
getFailedTestsFunction · 0.85
setSessionStatusFunction · 0.85

Tested by

no test coverage detected