diff --git a/package-lock.json b/package-lock.json index 70ee81c..3713777 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "type-fest": "^4.33.0" }, "devDependencies": { - "@cucumber/compatibility-kit": "^19.0.0", + "@cucumber/compatibility-kit": "^20.0.0", "@eslint/compat": "^1.2.5", "@eslint/eslintrc": "^3.2.0", "@eslint/js": "^9.18.0", @@ -67,9 +67,9 @@ "license": "MIT" }, "node_modules/@cucumber/compatibility-kit": { - "version": "19.0.0", - "resolved": "https://registry.npmjs.org/@cucumber/compatibility-kit/-/compatibility-kit-19.0.0.tgz", - "integrity": "sha512-wGFDDHo5vlkYo5YOCvfU0sjXjLizK2jKFojymrJB8kZo1wvcIDnWHriyizbUyOw1Aey2JvN9gI2mYcjwBpegVg==", + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@cucumber/compatibility-kit/-/compatibility-kit-20.0.0.tgz", + "integrity": "sha512-hrlelLdOP7ojqSDxbuzBLSfrwbV4js0ew2FlOqa2kTf/dOLrynhAvtPyDw0001xNBhqXr5YtGZIas/2WWkP5vA==", "dev": true, "license": "MIT" }, diff --git a/package.json b/package.json index 0cf56ef..dd6cb59 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "type-fest": "^4.33.0" }, "devDependencies": { - "@cucumber/compatibility-kit": "^19.0.0", + "@cucumber/compatibility-kit": "^20.0.0", "@eslint/compat": "^1.2.5", "@eslint/eslintrc": "^3.2.0", "@eslint/js": "^9.18.0", diff --git a/test/cck/cck.spec.ts b/test/cck/cck.spec.ts index 00eb6bf..995a39e 100644 --- a/test/cck/cck.spec.ts +++ b/test/cck/cck.spec.ts @@ -4,9 +4,8 @@ import path from 'node:path' import { expect, use } from 'chai' import chaiExclude from 'chai-exclude' import { makeTestHarness } from '../utils.js' -import { globSync } from 'node:fs' import { Envelope } from '@cucumber/messages' -import { Env } from '@cucumber/ci-environment' +import { globby, globbySync } from 'globby' use(chaiExclude) @@ -43,27 +42,32 @@ const UNSUPPORTED = [ ] describe('Cucumber Compatibility Kit', () => { - const ndjsonPaths = globSync('node_modules/@cucumber/compatibility-kit/features/**/*.ndjson') - for (const ndjsonPath of ndjsonPaths) { - const [, name, extension] = /^.+[/\\](.+)(\.feature(?:\.md)?)\.ndjson$/.exec( - ndjsonPath - ) as RegExpExecArray + const directories = globbySync('node_modules/@cucumber/compatibility-kit/features/*', { + onlyDirectories: true, + }) + for (const directory of directories) { + const suite = path.basename(directory) - it(name, async function () { - if (UNSUPPORTED.includes(name)) { + it(suite, async function () { + if (UNSUPPORTED.includes(suite)) { return this.skip() } const harness = await makeTestHarness() - await harness.copyDir(path.join(process.cwd(), 'test', 'cck', name), 'features') - await harness.copyFile( - path.join(CCK_PATH, 'features', name, name + extension), - path.join('features', name + extension) - ) + await harness.copyDir(path.join(process.cwd(), 'test', 'cck', suite), 'features') + const featurePaths = await globby(['*.feature', '*.feature.md'], { cwd: directory }) + for (const featurePath of featurePaths) { + await harness.copyFile( + path.join(CCK_PATH, 'features', suite, featurePath), + path.join('features', featurePath) + ) + } const [actualOutput] = await harness.run('@cucumber/node/reporters/message') - const expectedOutput = await readFile(ndjsonPath, { encoding: 'utf-8' }) + const expectedOutput = await readFile(path.join(directory, suite + '.ndjson'), { + encoding: 'utf-8', + }) const actualEnvelopes = parseEnvelopes(actualOutput) const expectedEnvelopes = parseEnvelopes(expectedOutput)