@vitest/runner 1.5.3 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +12 -2
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -470,9 +470,14 @@ function createSuite() {
470
470
  optionsOrFn,
471
471
  fnOrOptions
472
472
  );
473
+ const fnFirst = typeof optionsOrFn === "function";
473
474
  cases.forEach((i, idx) => {
474
475
  const items = Array.isArray(i) ? i : [i];
475
- arrayOnlyCases ? suite2(formatTitle(_name, items, idx), options, () => handler(...items)) : suite2(formatTitle(_name, items, idx), options, () => handler(i));
476
+ if (fnFirst) {
477
+ arrayOnlyCases ? suite2(formatTitle(_name, items, idx), () => handler(...items), options) : suite2(formatTitle(_name, items, idx), () => handler(i), options);
478
+ } else {
479
+ arrayOnlyCases ? suite2(formatTitle(_name, items, idx), options, () => handler(...items)) : suite2(formatTitle(_name, items, idx), options, () => handler(i));
480
+ }
476
481
  });
477
482
  this.setContext("each", void 0);
478
483
  };
@@ -498,9 +503,14 @@ function createTaskCollector(fn, context) {
498
503
  optionsOrFn,
499
504
  fnOrOptions
500
505
  );
506
+ const fnFirst = typeof optionsOrFn === "function";
501
507
  cases.forEach((i, idx) => {
502
508
  const items = Array.isArray(i) ? i : [i];
503
- arrayOnlyCases ? test2(formatTitle(_name, items, idx), options, () => handler(...items)) : test2(formatTitle(_name, items, idx), options, () => handler(i));
509
+ if (fnFirst) {
510
+ arrayOnlyCases ? test2(formatTitle(_name, items, idx), () => handler(...items), options) : test2(formatTitle(_name, items, idx), () => handler(i), options);
511
+ } else {
512
+ arrayOnlyCases ? test2(formatTitle(_name, items, idx), options, () => handler(...items)) : test2(formatTitle(_name, items, idx), options, () => handler(i));
513
+ }
504
514
  });
505
515
  this.setContext("each", void 0);
506
516
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/runner",
3
3
  "type": "module",
4
- "version": "1.5.3",
4
+ "version": "1.6.1",
5
5
  "description": "Vitest test runner",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -40,7 +40,7 @@
40
40
  "dependencies": {
41
41
  "p-limit": "^5.0.0",
42
42
  "pathe": "^1.1.1",
43
- "@vitest/utils": "1.5.3"
43
+ "@vitest/utils": "1.6.1"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "rimraf dist && rollup -c",