Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
# filtering branches here prevents duplicate builds from pull_request and push
branches:
- main
- master
- "v*"
# always run CI for tags
tags:
Expand All @@ -25,7 +26,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
Expand Down
6 changes: 5 additions & 1 deletion index.d.ts → main.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@
* });

*/
declare function retry(name: string, callback: (assert: Object) => void | Promise<void>, maxRuns?: number): void;
declare function retry(
name: string,
callback: (assert: Object) => void | Promise<void>,
maxRuns?: number,
): void;
11 changes: 2 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@
},
"license": "ISC",
"author": "mrloop",
"exports": {
"require": "./index.js",
"import": "./main.js",
"default": "./main.js"
},
"main": "index.js",
"type": "module",
"exports": "./main.js",
"module": "main.js",
"types": "./index.d.ts",
"scripts": {
Expand All @@ -30,9 +26,6 @@
"dev": "qunit --watch",
"lint": "eslint index.js"
},
"dependencies": {
"esm": "^3.2.25"
},
"devDependencies": {
"@release-it-plugins/lerna-changelog": "^7.0.0",
"dotenv": "^8.2.0",
Expand Down
10 changes: 0 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 60 additions & 44 deletions test/retry-only.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,60 @@
const setup = require('../index.js')
const QUnit = require('qunit')

const retry = setup(QUnit.test)

QUnit.module('retry.only', function () {
const calls = []

retry.only('count only retries', function (assert, currentRun) {
calls.push(['only', currentRun])

assert.equal(currentRun, 2)
})

retry('count non-only retries', function (assert, currentRun) {
calls.push(['non-only', currentRun])

assert.equal(currentRun, 2)
})

QUnit.test('verify calls', function (assert) {
assert.deepEqual(calls, [['only', 1], ['only', 2]])
})
})

QUnit.module('retry.only.each', function () {
const calls = []

retry.only.each('count only retries', ['A', 'B'], function (assert, data, currentRun) {
calls.push(['only', data, currentRun])

assert.equal(currentRun, 2)
})

retry.each('count non-only retries', ['A', 'B'], function (assert, data, currentRun) {
calls.push(['non-only', data, currentRun])

assert.equal(currentRun, 2)
})

QUnit.test('verify calls', function (assert) {
assert.deepEqual(calls, [['only', 'A', 1], ['only', 'A', 2], ['only', 'B', 1], ['only', 'B', 2]])
})
})
import setup from "qunit-retry";
import QUnit from "qunit";

const retry = setup(QUnit.test);

QUnit.module("retry.only", function () {
const calls = [];

retry.only("count only retries", function (assert, currentRun) {
calls.push(["only", currentRun]);

assert.equal(currentRun, 2);
});

retry("count non-only retries", function (assert, currentRun) {
calls.push(["non-only", currentRun]);

assert.equal(currentRun, 2);
});

QUnit.test("verify calls", function (assert) {
assert.deepEqual(calls, [
["only", 1],
["only", 2],
]);
});
});

QUnit.module("retry.only.each", function () {
const calls = [];

retry.only.each(
"count only retries",
["A", "B"],
function (assert, data, currentRun) {
calls.push(["only", data, currentRun]);

assert.equal(currentRun, 2);
},
);

retry.each(
"count non-only retries",
["A", "B"],
function (assert, data, currentRun) {
calls.push(["non-only", data, currentRun]);

assert.equal(currentRun, 2);
},
);

QUnit.test("verify calls", function (assert) {
assert.deepEqual(calls, [
["only", "A", 1],
["only", "A", 2],
["only", "B", 1],
["only", "B", 2],
]);
});
});
Loading