From 1ae472446ba94f3a77376a31a80a8296a3e76a56 Mon Sep 17 00:00:00 2001 From: Yaroslav Serhieiev Date: Mon, 18 Dec 2023 10:56:17 +0200 Subject: [PATCH] docs: updated docs --- docs/docs/api/01-descriptions.mdx | 14 +++++++------- docs/docs/api/02-steps.mdx | 12 ++++++------ docs/docs/api/03-attachments.mdx | 8 ++++---- docs/docs/api/04-parameters.mdx | 4 ++-- docs/docs/api/05-people.mdx | 4 ++-- docs/docs/api/06-severity.mdx | 4 ++-- docs/docs/api/07-links.mdx | 10 +++++----- docs/docs/config/01-grouping/01-by-suite.mdx | 2 +- docs/docs/config/01-grouping/02-by-story.mdx | 6 +++--- docs/docs/config/01-grouping/03-by-package.mdx | 4 ++-- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/docs/docs/api/01-descriptions.mdx b/docs/docs/api/01-descriptions.mdx index a2ecba6..782a2f7 100644 --- a/docs/docs/api/01-descriptions.mdx +++ b/docs/docs/api/01-descriptions.mdx @@ -82,7 +82,7 @@ Pseudo-annotations must be **before** the `test` statement to work. ::: ```js -import { $Description } from 'jest-allure2-reporter'; +import { $Description } from 'jest-allure2-reporter/api'; $Description('This test demonstrates the `+` operator.') test('should add two numbers', () => { @@ -128,7 +128,7 @@ afterEach(() => { ```js -import { $Description } from 'jest-allure2-reporter'; +import { $Description } from 'jest-allure2-reporter/api'; $Description('This hook runs before all tests.') beforeAll(() => { @@ -165,7 +165,7 @@ Due to Jest limitations, you can't use docblocks on a suite level, so the only w ```js -import { $Description } from 'jest-allure2-reporter'; +import { $Description } from 'jest-allure2-reporter/api'; $Description('The test is operating on `/login` page.') describe('Sanity: Login flow', () => { @@ -201,7 +201,7 @@ In many cases you may find it acceptable to describe the whole test file, which * @description * The test is operating on `/login` page. */ -import { $Description } from 'jest-allure2-reporter'; +import { $Description } from 'jest-allure2-reporter/api'; describe('Sanity: Login flow', () => { it('should login with valid credentials', () => { @@ -226,7 +226,7 @@ You **must** use `@desc` or `@description` pragma due to Jest limitations regard ```js -import { allure } from 'jest-allure2-reporter'; +import { allure } from 'jest-allure2-reporter/api'; allure.description('The test is operating on `/login` page.') @@ -282,7 +282,7 @@ module.exports = { 'default', [ 'jest-allure2-reporter', - /** @type {import('jest-allure2-reporter').Options} */ + /** @type {import('jest-allure2-reporter').ReporterOptions} */ { testCase: { description: ({ testCaseMetadata }) => [ @@ -312,7 +312,7 @@ module.exports = { 'default', [ 'jest-allure2-reporter', - /** @type {import('jest-allure2-reporter').Options} */ + /** @type {import('jest-allure2-reporter').ReporterOptions} */ { testCase: { description: () => {}, // suppress the default template diff --git a/docs/docs/api/02-steps.mdx b/docs/docs/api/02-steps.mdx index 700e4ab..a7770d8 100644 --- a/docs/docs/api/02-steps.mdx +++ b/docs/docs/api/02-steps.mdx @@ -58,7 +58,7 @@ afterAll(async () => { ```js -import { $Description } from 'jest-allure2-reporter'; +import { $Description } from 'jest-allure2-reporter/api'; $Description('Launch the browser for all tests') beforeAll(async () => { @@ -110,7 +110,7 @@ There are several ways to turn your functions into steps: Using `allure.step` function is the simplest way to define a step: ```js -import { allure } from 'jest-allure2-reporter'; +import { allure } from 'jest-allure2-reporter/api'; test('Login test', async () => { await allure.step('Open login page', async () => { @@ -138,7 +138,7 @@ A more advanced technique is to wrap your functions with `allure.createStep`, which allows you to reuse steps in other tests and add parameters: ```js -import { allure } from 'jest-allure2-reporter'; +import { allure } from 'jest-allure2-reporter/api'; export const open = allure.createStep('Open login page', async () => { // ... @@ -164,7 +164,7 @@ For aspect-oriented programmers, there is a decorator-based approach. It works o but otherwise it's similar to `allure.createStep`: ```js -import { Step } from 'jest-allure2-reporter'; +import { Step } from 'jest-allure2-reporter/api'; class LoginPageObject { @Step('Open login page') @@ -200,7 +200,7 @@ In some cases, you might want to have control over the step status and its statu ```js -import { allure, Status } from 'jest-allure2-reporter'; +import { allure } from 'jest-allure2-reporter/api'; test('Login test', async () => { try { @@ -213,7 +213,7 @@ test('Login test', async () => { ); if (isRecoverable()) { - allure.status(Status.SKIPPED, { + allure.status('skipped', { message: error.message, trace: error.stack, }); diff --git a/docs/docs/api/03-attachments.mdx b/docs/docs/api/03-attachments.mdx index 4e42f6d..bdd9bd5 100644 --- a/docs/docs/api/03-attachments.mdx +++ b/docs/docs/api/03-attachments.mdx @@ -30,7 +30,7 @@ The simplest way to start with attachments is to use the built-in ones: ```js -import { allure } from 'jest-allure2-reporter'; +import { allure } from 'jest-allure2-reporter/api'; test('Sample test', async () => { await allure.attachment('My attachment', 'This is a simple text attachment', 'text/plain'); @@ -54,7 +54,7 @@ For advanced use cases, you may want to create your own custom attachments: Using `allure.attachment` function is the most straightforward way to add a custom attachment: ```js -import { allure } from 'jest-allure2-reporter'; +import { allure } from 'jest-allure2-reporter/api'; test('Sample test', async () => { const myData = JSON.stringify({a: 1, b: 2}); @@ -70,7 +70,7 @@ The disadvantage of this approach is that it is less flexible and more verbose f The `allure.createAttachment` function provides a more advanced way to define a custom attachment: ```js -import { allure } from 'jest-allure2-reporter'; +import { allure } from 'jest-allure2-reporter/api'; const attachJson = allure.createAttachment('JSON attachment', (data) => { return JSON.stringify(data); @@ -90,7 +90,7 @@ The `allure.createAttachment` function is particularly useful for reusable attac For aspect-oriented programmers, there is a decorator-based approach: ```js -import { Attachment } from 'jest-allure2-reporter'; +import { Attachment } from 'jest-allure2-reporter/api'; class DeviceHelper { @Attachment('device-status-%s.json', 'application/json') diff --git a/docs/docs/api/04-parameters.mdx b/docs/docs/api/04-parameters.mdx index 523a0fc..46aed1e 100644 --- a/docs/docs/api/04-parameters.mdx +++ b/docs/docs/api/04-parameters.mdx @@ -14,7 +14,7 @@ Please use GitHub docs for the latest stable version, `1.x.x`. Utilize parameterized testing to avoid code duplication and reduce your maintenance costs: ```js -import {allure} from 'jest-allure2-reporter'; +import {allure} from 'jest-allure2-reporter/api'; test.each([ [1, 1, 2], @@ -51,7 +51,7 @@ The options allow you to fine-tune the way your parameters are displayed in the The `allure.parameter` API can be used also on the top level, e.g.: ```typescript -import {allure} from 'jest-allure2-reporter'; +import {allure} from 'jest-allure2-reporter/api'; describe('Login Screen (New)', () => { allure.parameter('featureToggles', { 'com.ShowNewLogin': 'true' }); diff --git a/docs/docs/api/05-people.mdx b/docs/docs/api/05-people.mdx index c73ef8c..5c4a977 100644 --- a/docs/docs/api/05-people.mdx +++ b/docs/docs/api/05-people.mdx @@ -55,7 +55,7 @@ describe('Sanity: Dashboard', () => { ```js -import { allure } from 'jest-allure2-reporter'; +import { allure } from 'jest-allure2-reporter/api'; allure.owner('John Doe '); @@ -98,7 +98,7 @@ Please note that you have to put the JSDoc comment inside the test suite functio ```js -import { $Owner } from 'jest-allure2-reporter'; +import { $Owner } from 'jest-allure2-reporter/api'; $Owner('John Doe '); describe('Sanity: Login flow', () => { diff --git a/docs/docs/api/06-severity.mdx b/docs/docs/api/06-severity.mdx index c3c1623..3bb29b8 100644 --- a/docs/docs/api/06-severity.mdx +++ b/docs/docs/api/06-severity.mdx @@ -60,7 +60,7 @@ describe('Sanity: Dashboard', () => { ```js -import { allure } from 'jest-allure2-reporter'; +import { allure } from 'jest-allure2-reporter/api'; allure.severity('critical'); @@ -120,7 +120,7 @@ Please note that you have to put the JSDoc comment inside the test suite functio ```js -import { $Severity } from 'jest-allure2-reporter'; +import { $Severity } from 'jest-allure2-reporter/api'; $Severity('blocker') describe('Sanity: Login flow', () => { diff --git a/docs/docs/api/07-links.mdx b/docs/docs/api/07-links.mdx index 111b230..ba5ed43 100644 --- a/docs/docs/api/07-links.mdx +++ b/docs/docs/api/07-links.mdx @@ -23,7 +23,7 @@ In Allure reports, you can add different types of links to your test cases for b There are two ways to add links to your test cases: * declaratively, using JSDoc annotations such as `@link`, `@issue`, and `@tms`; -* programmatically, using annotation functions from the 'jest-allure2-reporter' package such as `$Link`, `$Issue`, and `$TmsLink`. +* programmatically, using annotation functions from the 'jest-allure2-reporter/api' package such as `$Link`, `$Issue`, and `$TmsLink`. ## Issue Links @@ -46,7 +46,7 @@ it('should validate non-ASCII passwords', () => { ```js -import { $Issue } from 'jest-allure2-reporter'; +import { $Issue } from 'jest-allure2-reporter/api'; // A customer ticket from our Support team. $Issue('AUTH-123'); @@ -82,7 +82,7 @@ it('should be connected to TMS', () => { ```js -import { $TmsLink } from 'jest-allure2-reporter'; +import { $TmsLink } from 'jest-allure2-reporter/api'; $TmsLink('TMS-123'); it('should be connected to TMS', () => { @@ -117,7 +117,7 @@ it('should demonstrate how the links work', () => { ```js -import { $Link } from 'jest-allure2-reporter'; +import { $Link } from 'jest-allure2-reporter/api'; $Link('https://example.com/custom'); it('should demonstrate how the links work', () => { @@ -150,7 +150,7 @@ it('should demonstrate how the links work', () => { ```js -import { $Link } from 'jest-allure2-reporter'; +import { $Link } from 'jest-allure2-reporter/api'; $Link('docs', 'features/links'); it('should demonstrate how the links work', () => { diff --git a/docs/docs/config/01-grouping/01-by-suite.mdx b/docs/docs/config/01-grouping/01-by-suite.mdx index 7d14021..2e1610d 100644 --- a/docs/docs/config/01-grouping/01-by-suite.mdx +++ b/docs/docs/config/01-grouping/01-by-suite.mdx @@ -202,7 +202,7 @@ module.exports = { testEnvironment: 'jest-allure2-reporter/environment-node', reporters: [ 'default', - ['jest-allure2-reporter', /** @type {import('jest-allure2-reporter').Options}*/ { + ['jest-allure2-reporter', /** @type {import('jest-allure2-reporter').ReporterOptions}*/ { labels: { parentSuite: ({ file }) => file.path, suite: ({ test }) => test.ancestorTitles[0], diff --git a/docs/docs/config/01-grouping/02-by-story.mdx b/docs/docs/config/01-grouping/02-by-story.mdx index 5d84519..12aa59a 100644 --- a/docs/docs/config/01-grouping/02-by-story.mdx +++ b/docs/docs/config/01-grouping/02-by-story.mdx @@ -80,7 +80,7 @@ describe('Login controller', () => { ```js title="login.test.js" -import { $Epic, $Feature, $Story } from 'jest-allure2-reporter'; +import { $Epic, $Feature, $Story } from 'jest-allure2-reporter/api'; $Epic('Authentication'); $Feature('Login screen'); @@ -136,7 +136,7 @@ module.exports = { 'default', [ 'jest-allure2-reporter', - /** @type {import('jest-allure2-reporter').Options} */ + /** @type {import('jest-allure2-reporter').ReporterOptions} */ { labels: { epic: ({ value }) => value ?? 'Uncategorized', @@ -176,7 +176,7 @@ module.exports = { testEnvironment: 'jest-allure2-reporter/environment-node', reporters: [ 'default', - ['jest-allure2-reporter', /** @type {import('jest-allure2-reporter').Options}*/ { + ['jest-allure2-reporter', /** @type {import('jest-allure2-reporter').ReporterOptions}*/ { labels: { epic: ({ testCase }) => testCase.ancestorTitles.at(0) ?? '(uncategorized)', feature: ({ testCase }) => testCase.ancestorTitles.slice(1, -1).join(' > ') || '(uncategorized)', diff --git a/docs/docs/config/01-grouping/03-by-package.mdx b/docs/docs/config/01-grouping/03-by-package.mdx index 394d9b9..8ca4cc4 100644 --- a/docs/docs/config/01-grouping/03-by-package.mdx +++ b/docs/docs/config/01-grouping/03-by-package.mdx @@ -45,7 +45,7 @@ module.exports = { testEnvironment: 'jest-allure2-reporter/environment-node', reporters: [ 'default', - ['jest-allure2-reporter', /** @type {import('jest-allure2-reporter').Options}*/ { + ['jest-allure2-reporter', /** @type {import('jest-allure2-reporter').ReporterOptions}*/ { labels: { package: ({ manifest }) => manifest.name, // ⚠️ `testClass` won't work due to the aforementioned issue @@ -94,7 +94,7 @@ module.exports = { reporters: [ 'default', ['jest-allure2-reporter', - /** @type {import('jest-allure2-reporter').Options}*/ + /** @type {import('jest-allure2-reporter').ReporterOptions}*/ { labels: { package: ({ filePath }) => filePath.slice(0, -1).join('.'),