Skip to content

Commit c7e9292

Browse files
committed
fix: ensure all tags in config are normalized
1 parent 99fe7bf commit c7e9292

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

.changeset/small-peas-judge.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"quickpickle": patch
3+
---
4+
5+
Fixed ensure all tags configs are normalized

packages/main/src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ interface ResolvedConfig {
133133
};
134134
}
135135

136-
function normalizeTags(tags:string|string[]):string[] {
137-
tags = Array.isArray(tags) ? tags : [tags]
136+
export function normalizeTags(tags:string|string[]):string[] {
137+
tags = Array.isArray(tags) ? tags : tags.split(/\s*,\s*/g)
138138
return tags.filter(Boolean).map(tag => tag.startsWith('@') ? tag : `@${tag}`)
139139
}
140140

@@ -148,8 +148,11 @@ export const quickpickle = function() {
148148
defaultConfig,
149149
get(resolvedConfig, 'test.quickpickle')
150150
) as QuickPickleConfig;
151+
config.todoTags = normalizeTags(config.todoTags)
151152
config.skipTags = normalizeTags(config.skipTags)
152153
config.failTags = normalizeTags(config.failTags)
154+
config.concurrentTags = normalizeTags(config.concurrentTags)
155+
config.sequentialTags = normalizeTags(config.sequentialTags)
153156
},
154157
transform: async (src: string, id: string): Promise<string | undefined> => {
155158
if (featureRegex.test(id)) {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { expect, test } from 'vitest'
22
import { renderGherkin } from '../src/render'
3-
import { defaultConfig } from '../src'
3+
import { defaultConfig, normalizeTags } from '../src'
44
import fs from 'node:fs'
55

66
const featureFile = fs.readFileSync(__dirname + '/../gherkin-example/example.feature', 'utf8')
77
const jsFile = fs.readFileSync(__dirname + '/../gherkin-example/example.feature.js', 'utf8')
88

99
test('rendering the example feature file', () => {
10-
expect(jsFile).toEqual(renderGherkin(featureFile, defaultConfig))
10+
expect(jsFile).toEqual(renderGherkin(featureFile, {...defaultConfig, failTags: normalizeTags('fail, fails')}))
1111
})

0 commit comments

Comments
 (0)