Skip to content

Commit f53251f

Browse files
committed
Add option to disable concurrent testing
1 parent d45210e commit f53251f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Options are passed as an object to the vitestBdd function. The default options a
5959
```ts
6060
{
6161
debug: false,
62+
concurrent: true,
6263
markdownExtensions: [".md", ".mdx", ".markdown"],
6364
gherkinExtensions: [".feature"],
6465
stepsResolver: stepsResolver,
@@ -399,6 +400,7 @@ And finally, here are some nice extensions for VS Code that can support your BDD
399400

400401
- **0.6.0** (2025-09-01)
401402
- Add support for table parsing (toRecords, toNumbers, toStrings)
403+
- Add `concurrent` option (true by default)
402404
- **0.5.1** (2025-08-28)
403405
- Remove support for arrays in tests (accidental breaking change)
404406
- **0.5.0** (2025-08-27)

vitest-bdd/src/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export * from "./utils";
99

1010
export type VitestBddOptions = {
1111
debug?: boolean;
12+
concurrent?: boolean;
1213
markdownExtensions?: string[];
1314
gherkinExtensions?: string[];
1415
rescriptExtensions?: string[];
@@ -18,6 +19,7 @@ export type VitestBddOptions = {
1819

1920
const defaultOptions: Required<VitestBddOptions> = {
2021
debug: false,
22+
concurrent: true,
2123
markdownExtensions: [".md", ".mdx", ".markdown"],
2224
gherkinExtensions: [".feature"],
2325
rescriptExtensions: [".res"],
@@ -47,6 +49,7 @@ export function vitestBdd(opts: VitestBddOptions = {}): Plugin {
4749
function compile(path: string, opts: Required<VitestBddOptions>) {
4850
const { debug, rescriptExtensions, markdownExtensions, gherkinExtensions } =
4951
opts;
52+
const concurrent = opts.concurrent ? ".concurrent" : "";
5053
const ext = extname(path);
5154
if (rescriptExtensions.includes(ext)) {
5255
return resCompile(path, opts);
@@ -81,11 +84,10 @@ function compile(path: string, opts: Required<VitestBddOptions>) {
8184
const base = { line: 1, column: 0 };
8285
const stepsPath = opts.stepsResolver(path);
8386
if (!stepsPath) {
84-
const shortpath =
85-
path.split("/").slice(-4).join("/");
87+
const shortpath = path.split("/").slice(-4).join("/");
8688
push(`import { describe, it, assert } from "vitest";`, base);
8789
push(
88-
`describe.concurrent(${JSON.stringify(feature.title)}, () => {`,
90+
`describe${concurrent}(${JSON.stringify(feature.title)}, () => {`,
8991
feature.location
9092
);
9193
push(
@@ -105,7 +107,7 @@ function compile(path: string, opts: Required<VitestBddOptions>) {
105107
push(`import { load } from "vitest-bdd";`, base);
106108
push(`import ${JSON.stringify(stepsPath)};`, base);
107109
push(
108-
`describe.concurrent(${JSON.stringify(feature.title)}, () => {`,
110+
`describe${concurrent}(${JSON.stringify(feature.title)}, () => {`,
109111
feature.location
110112
);
111113
for (const scenario of feature.scenarios) {

0 commit comments

Comments
 (0)