From 22f1a60c007b737b021f3fbea22fad6643348025 Mon Sep 17 00:00:00 2001 From: Jonas Amundsen Date: Mon, 12 Jun 2023 14:13:13 +0200 Subject: [PATCH] Tmp --- .mocharc.js => .mocharc.cjs | 0 package-lock.json | 118 +++++++++++++++++++++++++++------- package.json | 5 +- src/indentStyleText.spec.ts | 4 +- src/indentStyleText.ts | 2 +- src/index.ts | 10 +-- src/styleText.spec.ts | 2 +- src/styleText.ts | 7 +- src/theme.spec.ts | 4 +- src/theme.ts | 4 +- test/background.spec.ts | 4 +- test/data-table.spec.ts | 2 +- test/description.spec.ts | 2 +- test/doc-string.spec.ts | 2 +- test/exec.ts | 9 ++- test/feature.spec.ts | 2 +- test/hook.spec.ts | 2 +- test/i18n.spec.ts | 2 +- test/rule.spec.ts | 2 +- test/scenario-outline.spec.ts | 2 +- test/scenario.spec.ts | 2 +- test/step.spec.ts | 2 +- test/summary.spec.ts | 2 +- test/tag.spec.ts | 2 +- test/text-styling.spec.ts | 8 +-- tsconfig.json | 3 +- 26 files changed, 136 insertions(+), 68 deletions(-) rename .mocharc.js => .mocharc.cjs (100%) diff --git a/.mocharc.js b/.mocharc.cjs similarity index 100% rename from .mocharc.js rename to .mocharc.cjs diff --git a/package-lock.json b/package-lock.json index 0aa43d1..4266edc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,9 +9,9 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "ansi-styles": "^5.0.0", + "ansi-styles": "^6.2.1", "cli-table3": "^0.6.0", - "figures": "^3.2.0", + "figures": "^5.0.0", "ts-dedent": "^2.0.0" }, "devDependencies": { @@ -151,6 +151,30 @@ "uuid": "8.3.2" } }, + "node_modules/@cucumber/cucumber/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@cucumber/cucumber/node_modules/figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@cucumber/cucumber/node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -994,11 +1018,14 @@ } }, "node_modules/ansi-styles": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.0.0.tgz", - "integrity": "sha512-6564t0m0fuQMnockqBv7wJxo9T5C2V9JpYXyNScfRDPVLusOQQhkpMGrFC17QbiolraQ1sMXX+Y5nJpjqozL4g==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", "engines": { - "node": ">=10" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/any-promise": { @@ -1546,11 +1573,14 @@ } }, "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", "engines": { - "node": ">=0.8.0" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/eslint": { @@ -2101,14 +2131,29 @@ } }, "node_modules/figures": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-5.0.0.tgz", + "integrity": "sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==", "dependencies": { - "escape-string-regexp": "^1.0.5" + "escape-string-regexp": "^5.0.0", + "is-unicode-supported": "^1.2.0" }, "engines": { - "node": ">=8" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/figures/node_modules/is-unicode-supported": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", + "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/file-entry-cache": { @@ -4362,6 +4407,21 @@ "uuid": "8.3.2" } }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true + }, + "figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -4966,9 +5026,9 @@ "dev": true }, "ansi-styles": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.0.0.tgz", - "integrity": "sha512-6564t0m0fuQMnockqBv7wJxo9T5C2V9JpYXyNScfRDPVLusOQQhkpMGrFC17QbiolraQ1sMXX+Y5nJpjqozL4g==" + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==" }, "any-promise": { "version": "1.3.0", @@ -5419,9 +5479,9 @@ "dev": true }, "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==" }, "eslint": { "version": "8.30.0", @@ -5858,11 +5918,19 @@ } }, "figures": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-5.0.0.tgz", + "integrity": "sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==", "requires": { - "escape-string-regexp": "^1.0.5" + "escape-string-regexp": "^5.0.0", + "is-unicode-supported": "^1.2.0" + }, + "dependencies": { + "is-unicode-supported": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", + "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==" + } } }, "file-entry-cache": { diff --git a/package.json b/package.json index 3d7d7c0..32e7f0c 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "Julien Biezemans " ], "license": "MIT", + "type": "module", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "files": [ @@ -35,9 +36,9 @@ "update-dependencies": "npx npm-check-updates --upgrade --dep prod,dev,optional,bundle" }, "dependencies": { - "ansi-styles": "^5.0.0", + "ansi-styles": "^6.2.1", "cli-table3": "^0.6.0", - "figures": "^3.2.0", + "figures": "^5.0.0", "ts-dedent": "^2.0.0" }, "peerDependencies": { diff --git a/src/indentStyleText.spec.ts b/src/indentStyleText.spec.ts index 884e967..4ef43b6 100644 --- a/src/indentStyleText.spec.ts +++ b/src/indentStyleText.spec.ts @@ -1,7 +1,7 @@ import 'should' -import { indentStyleText } from './indentStyleText' -import { styleText } from './styleText' +import { indentStyleText } from './indentStyleText.js' +import { styleText } from './styleText.js' describe('indentStyleText', () => { it('leaves text unstyled', () => { diff --git a/src/indentStyleText.ts b/src/indentStyleText.ts index 9c90bac..92cc6e1 100644 --- a/src/indentStyleText.ts +++ b/src/indentStyleText.ts @@ -1,4 +1,4 @@ -import { styleText, TextStyle } from './styleText' +import { styleText, TextStyle } from './styleText.js' export const indentStyleText = ( indent: number, diff --git a/src/index.ts b/src/index.ts index a8d7880..58d5391 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,11 +6,11 @@ import { } from '@cucumber/cucumber' import * as messages from '@cucumber/messages' import * as CliTable3 from 'cli-table3' -import { cross, tick } from 'figures' +import figures from 'figures' import { EOL as n } from 'os' import dedent from 'ts-dedent' -import { makeTheme, ThemeItem, ThemeStyles } from './theme' +import { makeTheme, ThemeItem, ThemeStyles } from './theme.js' const { formatLocation, GherkinDocumentParser, PickleParser } = formatterHelpers const { @@ -21,9 +21,9 @@ const { const { getPickleStepMap } = PickleParser const marks = { - [Status.AMBIGUOUS]: cross, - [Status.FAILED]: cross, - [Status.PASSED]: tick, + [Status.AMBIGUOUS]: figures.cross, + [Status.FAILED]: figures.cross, + [Status.PASSED]: figures.tick, [Status.PENDING]: '?', [Status.SKIPPED]: '-', [Status.UNDEFINED]: '?', diff --git a/src/styleText.spec.ts b/src/styleText.spec.ts index 5f7e229..2baa45a 100644 --- a/src/styleText.spec.ts +++ b/src/styleText.spec.ts @@ -1,6 +1,6 @@ import 'should' -import { styleText } from './styleText' +import { styleText } from './styleText.js' describe('styleText()', () => { it('applies modifiers', () => { diff --git a/src/styleText.ts b/src/styleText.ts index fee10bb..529ca33 100644 --- a/src/styleText.ts +++ b/src/styleText.ts @@ -1,13 +1,12 @@ -import { +import ansi, { BackgroundColor, - bgColor, - color, CSPair, ForegroundColor, - modifier, Modifier, } from 'ansi-styles' +const { bgColor, color, modifier } = ansi + export type TextStyle = | keyof BackgroundColor | keyof ForegroundColor diff --git a/src/theme.spec.ts b/src/theme.spec.ts index 3e9250c..7ae6395 100644 --- a/src/theme.spec.ts +++ b/src/theme.spec.ts @@ -1,12 +1,12 @@ import 'should' -import { styleText } from './styleText' +import { styleText } from './styleText.js' import { IndentStyleThemeItem, makeTheme, ThemeItem, ThemeStyles, -} from './theme' +} from './theme.js' describe('Theme', () => { let styleThemeItem: IndentStyleThemeItem diff --git a/src/theme.ts b/src/theme.ts index 32f40a4..54dc5fe 100644 --- a/src/theme.ts +++ b/src/theme.ts @@ -1,5 +1,5 @@ -import { indentStyleText } from './indentStyleText' -import { TextStyle } from './styleText' +import { indentStyleText } from './indentStyleText.js' +import { TextStyle } from './styleText.js' export enum ThemeItem { DataTable = 'datatable', diff --git a/test/background.spec.ts b/test/background.spec.ts index 89cbba8..b74f9e7 100644 --- a/test/background.spec.ts +++ b/test/background.spec.ts @@ -1,8 +1,8 @@ import 'should' -import { run } from './exec' +import { run } from './exec.js' -describe('Background', () => { +describe.only('Background', () => { it('does not log backgrounds', async () => { const result = await run('background.feature') result.should.startWith( diff --git a/test/data-table.spec.ts b/test/data-table.spec.ts index e43d916..d762646 100644 --- a/test/data-table.spec.ts +++ b/test/data-table.spec.ts @@ -1,6 +1,6 @@ import 'should' -import { run } from './exec' +import { run } from './exec.js' describe('Data Table', () => { it('logs data tables', async () => { diff --git a/test/description.spec.ts b/test/description.spec.ts index 4b506c1..a50f4e4 100644 --- a/test/description.spec.ts +++ b/test/description.spec.ts @@ -1,6 +1,6 @@ import 'should' -import { run } from './exec' +import { run } from './exec.js' describe('Description', () => { it('logs feature descriptions', async () => { diff --git a/test/doc-string.spec.ts b/test/doc-string.spec.ts index 99787fc..dbba757 100644 --- a/test/doc-string.spec.ts +++ b/test/doc-string.spec.ts @@ -1,6 +1,6 @@ import 'should' -import { run } from './exec' +import { run } from './exec.js' describe('Doc String', () => { it('logs doc strings', async () => { diff --git a/test/exec.ts b/test/exec.ts index f6f4d88..0e3f7b0 100644 --- a/test/exec.ts +++ b/test/exec.ts @@ -3,7 +3,7 @@ import { loadConfiguration, runCucumber, } from '@cucumber/cucumber/api' -import * as glob from 'glob' +import glob from 'glob' import { join } from 'path' import { PassThrough } from 'stream' import * as streamToString from 'stream-to-string' @@ -50,15 +50,14 @@ export const run = async ( await runCucumber(runConfiguration, { cwd: join(__dirname, '..', '..'), stdout, - stderr, + stderr: process.stderr, }) } catch (ex) { - if (throws) { - throw ex - } + throw ex } stdout.end() stderr.end() const result = await streamToString(stdout) + console.log({result}) return result.replace(/\d+m\d+\.\d+s/g, '0m00.000s') } diff --git a/test/feature.spec.ts b/test/feature.spec.ts index a73be96..2b679f9 100644 --- a/test/feature.spec.ts +++ b/test/feature.spec.ts @@ -1,6 +1,6 @@ import 'should' -import { run } from './exec' +import { run } from './exec.js' describe('Feature', () => { it('logs feature names and inserts new lines between scenarios and features', async () => { diff --git a/test/hook.spec.ts b/test/hook.spec.ts index 5c8c9f4..1df135f 100644 --- a/test/hook.spec.ts +++ b/test/hook.spec.ts @@ -1,6 +1,6 @@ import 'should' -import { run } from './exec' +import { run } from './exec.js' describe('Hook', () => { it('does not log hooks', async () => { diff --git a/test/i18n.spec.ts b/test/i18n.spec.ts index 9c6224a..142d009 100644 --- a/test/i18n.spec.ts +++ b/test/i18n.spec.ts @@ -1,6 +1,6 @@ import 'should' -import { run } from './exec' +import { run } from './exec.js' describe('Internationalization', () => { it('logs French', async () => { diff --git a/test/rule.spec.ts b/test/rule.spec.ts index 0868d0b..52690be 100644 --- a/test/rule.spec.ts +++ b/test/rule.spec.ts @@ -1,6 +1,6 @@ import 'should' -import { run } from './exec' +import { run } from './exec.js' describe('Rule', () => { it('logs rules', async () => { diff --git a/test/scenario-outline.spec.ts b/test/scenario-outline.spec.ts index fe128b4..1259e8b 100644 --- a/test/scenario-outline.spec.ts +++ b/test/scenario-outline.spec.ts @@ -1,6 +1,6 @@ import 'should' -import { run } from './exec' +import { run } from './exec.js' describe('Scenario Outline', () => { it('logs scenario outlines', async () => { diff --git a/test/scenario.spec.ts b/test/scenario.spec.ts index 93b31c8..ebf4c70 100644 --- a/test/scenario.spec.ts +++ b/test/scenario.spec.ts @@ -1,6 +1,6 @@ import 'should' -import { run } from './exec' +import { run } from './exec.js' describe('Scenario', () => { it('logs scenario names', async () => { diff --git a/test/step.spec.ts b/test/step.spec.ts index 84b759f..f0b8447 100644 --- a/test/step.spec.ts +++ b/test/step.spec.ts @@ -1,6 +1,6 @@ import 'should' -import { run } from './exec' +import { run } from './exec.js' describe('Step', () => { it('logs steps', async () => { diff --git a/test/summary.spec.ts b/test/summary.spec.ts index ddef8a1..6767339 100644 --- a/test/summary.spec.ts +++ b/test/summary.spec.ts @@ -1,6 +1,6 @@ import 'should' -import { run } from './exec' +import { run } from './exec.js' describe('Summary', () => { it('logs empty run summaries', async () => { diff --git a/test/tag.spec.ts b/test/tag.spec.ts index f60ab14..8a7d914 100644 --- a/test/tag.spec.ts +++ b/test/tag.spec.ts @@ -1,6 +1,6 @@ import 'should' -import { run } from './exec' +import { run } from './exec.js' describe('Tag', () => { it('log feature tags', async () => { diff --git a/test/text-styling.spec.ts b/test/text-styling.spec.ts index 965e489..1d658f5 100644 --- a/test/text-styling.spec.ts +++ b/test/text-styling.spec.ts @@ -1,9 +1,9 @@ import 'should' -import { indentStyleText } from '../src/indentStyleText' -import { styleText, TextStyle } from '../src/styleText' -import { ThemeItem, ThemeStyles } from '../src/theme' -import { run } from './exec' +import { indentStyleText } from '../src/indentStyleText.js' +import { styleText, TextStyle } from '../src/styleText.js' +import { ThemeItem, ThemeStyles } from '../src/theme.js' +import { run } from './exec.js' describe('Text styling', () => { const runColored = ( diff --git a/tsconfig.json b/tsconfig.json index a8dce09..f1d7de0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,8 @@ { "compilerOptions": { + "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "module": "none", + "module": "esnext", "moduleResolution": "node", "noImplicitAny": true, "noImplicitReturns": true,