Skip to content

Instantly share code, notes, and snippets.

@nicksteffens
Last active March 6, 2020 21:48
Show Gist options
  • Select an option

  • Save nicksteffens/8a2503dec7ff531e19d8b90c43dcf99d to your computer and use it in GitHub Desktop.

Select an option

Save nicksteffens/8a2503dec7ff531e19d8b90c43dcf99d to your computer and use it in GitHub Desktop.
Simple DOM query to use with Qunit results to find slow tests
let slowTests = [];
const testElements = document.querySelectorAll('li[id].pass');
const tolerance = 1500;
testElements.forEach(test => {
const moduleName = test.getElementsByClassName('module-name')[0].textContent
const testName = test.getElementsByClassName('test-name')[0].textContent
const testDurationString = test.getElementsByClassName('runtime')[0].textContent
const testDuration = parseInt(testDurationString.slice(0, -3))
if (testDuration > tolerance) {
slowTests.push(`- [ ] ${moduleName} ${testName} ${testDurationString}`)
}
});
console.log(slowTests.join('\n'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment