@@ -4,9 +4,8 @@ import path from 'node:path'
4
4
import { expect , use } from 'chai'
5
5
import chaiExclude from 'chai-exclude'
6
6
import { makeTestHarness } from '../utils.js'
7
- import { globSync } from 'node:fs'
8
7
import { Envelope } from '@cucumber/messages'
9
- import { Env } from '@cucumber/ci-environment '
8
+ import { globby , globbySync } from 'globby '
10
9
11
10
use ( chaiExclude )
12
11
@@ -43,27 +42,32 @@ const UNSUPPORTED = [
43
42
]
44
43
45
44
describe ( 'Cucumber Compatibility Kit' , ( ) => {
46
- const ndjsonPaths = globSync ( 'node_modules/@cucumber/compatibility-kit/features/**/*.ndjson' )
47
- for ( const ndjsonPath of ndjsonPaths ) {
48
- const [ , name , extension ] = / ^ . + [ / \\ ] ( . + ) ( \. f e a t u r e (?: \. m d ) ? ) \. n d j s o n $ / . exec (
49
- ndjsonPath
50
- ) as RegExpExecArray
45
+ const directories = globbySync ( 'node_modules/@cucumber/compatibility-kit/features/*' , {
46
+ onlyDirectories : true ,
47
+ } )
48
+ for ( const directory of directories ) {
49
+ const suite = path . basename ( directory )
51
50
52
- it ( name , async function ( ) {
53
- if ( UNSUPPORTED . includes ( name ) ) {
51
+ it ( suite , async function ( ) {
52
+ if ( UNSUPPORTED . includes ( suite ) ) {
54
53
return this . skip ( )
55
54
}
56
55
57
56
const harness = await makeTestHarness ( )
58
57
59
- await harness . copyDir ( path . join ( process . cwd ( ) , 'test' , 'cck' , name ) , 'features' )
60
- await harness . copyFile (
61
- path . join ( CCK_PATH , 'features' , name , name + extension ) ,
62
- path . join ( 'features' , name + extension )
63
- )
58
+ await harness . copyDir ( path . join ( process . cwd ( ) , 'test' , 'cck' , suite ) , 'features' )
59
+ const featurePaths = await globby ( [ '*.feature' , '*.feature.md' ] , { cwd : directory } )
60
+ for ( const featurePath of featurePaths ) {
61
+ await harness . copyFile (
62
+ path . join ( CCK_PATH , 'features' , suite , featurePath ) ,
63
+ path . join ( 'features' , featurePath )
64
+ )
65
+ }
64
66
65
67
const [ actualOutput ] = await harness . run ( '@cucumber/node/reporters/message' )
66
- const expectedOutput = await readFile ( ndjsonPath , { encoding : 'utf-8' } )
68
+ const expectedOutput = await readFile ( path . join ( directory , suite + '.ndjson' ) , {
69
+ encoding : 'utf-8' ,
70
+ } )
67
71
68
72
const actualEnvelopes = parseEnvelopes ( actualOutput )
69
73
const expectedEnvelopes = parseEnvelopes ( expectedOutput )
0 commit comments