aboutsummaryrefslogtreecommitdiffstats
path: root/tests/runner/lib/prettyMs.js
diff options
context:
space:
mode:
authorTimmy Willison <timmywil@users.noreply.github.com>2024-03-29 09:13:46 -0400
committerGitHub <noreply@github.com>2024-03-29 09:13:46 -0400
commit91df20be6b488ac6cf4da291d7ee3aa5d6feac73 (patch)
tree56b5c4f8b96a8323e3a6ce9c02c3e84c85a9d6d5 /tests/runner/lib/prettyMs.js
parent802642c37323d5fc05bfa4cee90a900953f9a98d (diff)
downloadjquery-ui-91df20be6b488ac6cf4da291d7ee3aa5d6feac73.tar.gz
jquery-ui-91df20be6b488ac6cf4da291d7ee3aa5d6feac73.zip
Tests: replace grunt-contrib-qunit with jQuery test runner
- add filestash workflow Close gh-2221
Diffstat (limited to 'tests/runner/lib/prettyMs.js')
-rw-r--r--tests/runner/lib/prettyMs.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/runner/lib/prettyMs.js b/tests/runner/lib/prettyMs.js
new file mode 100644
index 000000000..99bae2b35
--- /dev/null
+++ b/tests/runner/lib/prettyMs.js
@@ -0,0 +1,18 @@
+/**
+ * Pretty print a time in milliseconds.
+ */
+export function prettyMs( time ) {
+ const minutes = Math.floor( time / 60000 );
+ const seconds = Math.floor( time / 1000 );
+ const ms = Math.floor( time % 1000 );
+
+ let prettyTime = `${ ms }ms`;
+ if ( seconds > 0 ) {
+ prettyTime = `${ seconds }s ${ prettyTime }`;
+ }
+ if ( minutes > 0 ) {
+ prettyTime = `${ minutes }m ${ prettyTime }`;
+ }
+
+ return prettyTime;
+}