Skip to content

Commit

Permalink
docs: updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
noomorph committed Dec 18, 2023
1 parent b9e9b0f commit 1ae4724
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 34 deletions.
14 changes: 7 additions & 7 deletions docs/docs/api/01-descriptions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -128,7 +128,7 @@ afterEach(() => {
<TabItem value="dsl" label="DSL">

```js
import { $Description } from 'jest-allure2-reporter';
import { $Description } from 'jest-allure2-reporter/api';

$Description('This hook runs before all tests.')
beforeAll(() => {
Expand Down Expand Up @@ -165,7 +165,7 @@ Due to Jest limitations, you can't use docblocks on a suite level, so the only w
<TabItem value="dsl" label="DSL">

```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', () => {
Expand Down Expand Up @@ -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', () => {
Expand All @@ -226,7 +226,7 @@ You **must** use `@desc` or `@description` pragma due to Jest limitations regard
<TabItem value="dsl" label="DSL">

```js
import { allure } from 'jest-allure2-reporter';
import { allure } from 'jest-allure2-reporter/api';

allure.description('The test is operating on `/login` page.')

Expand Down Expand Up @@ -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 }) => [
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions docs/docs/api/02-steps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ afterAll(async () => {
<TabItem value="dsl" label="DSL">

```js
import { $Description } from 'jest-allure2-reporter';
import { $Description } from 'jest-allure2-reporter/api';

$Description('Launch the browser for all tests')
beforeAll(async () => {
Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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 () => {
// ...
Expand All @@ -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')
Expand Down Expand Up @@ -200,7 +200,7 @@ In some cases, you might want to have control over the step status and its statu
<TabItem value="logStep">

```js
import { allure, Status } from 'jest-allure2-reporter';
import { allure } from 'jest-allure2-reporter/api';

test('Login test', async () => {
try {
Expand All @@ -213,7 +213,7 @@ test('Login test', async () => {
);

if (isRecoverable()) {
allure.status(Status.SKIPPED, {
allure.status('skipped', {
message: error.message,
trace: error.stack,
});
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/api/03-attachments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The simplest way to start with attachments is to use the built-in ones:
<TabItem value="function" label="DSL">

```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');
Expand All @@ -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});
Expand All @@ -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);
Expand All @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/api/04-parameters.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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' });
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/api/05-people.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('Sanity: Dashboard', () => {
<TabItem value="dsl" label="DSL">

```js
import { allure } from 'jest-allure2-reporter';
import { allure } from 'jest-allure2-reporter/api';

allure.owner('John Doe <[email protected]>');

Expand Down Expand Up @@ -98,7 +98,7 @@ Please note that you have to put the JSDoc comment inside the test suite functio
<TabItem value="dsl" label="DSL">

```js
import { $Owner } from 'jest-allure2-reporter';
import { $Owner } from 'jest-allure2-reporter/api';

$Owner('John Doe <[email protected]>');
describe('Sanity: Login flow', () => {
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/api/06-severity.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('Sanity: Dashboard', () => {
<TabItem value="dsl" label="DSL">

```js
import { allure } from 'jest-allure2-reporter';
import { allure } from 'jest-allure2-reporter/api';

allure.severity('critical');

Expand Down Expand Up @@ -120,7 +120,7 @@ Please note that you have to put the JSDoc comment inside the test suite functio
<TabItem value="dsl" label="DSL">

```js
import { $Severity } from 'jest-allure2-reporter';
import { $Severity } from 'jest-allure2-reporter/api';

$Severity('blocker')
describe('Sanity: Login flow', () => {
Expand Down
10 changes: 5 additions & 5 deletions docs/docs/api/07-links.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -46,7 +46,7 @@ it('should validate non-ASCII passwords', () => {
<TabItem value="dsl" label="DSL">

```js
import { $Issue } from 'jest-allure2-reporter';
import { $Issue } from 'jest-allure2-reporter/api';

// A customer ticket from our Support team.
$Issue('AUTH-123');
Expand Down Expand Up @@ -82,7 +82,7 @@ it('should be connected to TMS', () => {
<TabItem value="dsl" label="DSL">

```js
import { $TmsLink } from 'jest-allure2-reporter';
import { $TmsLink } from 'jest-allure2-reporter/api';

$TmsLink('TMS-123');
it('should be connected to TMS', () => {
Expand Down Expand Up @@ -117,7 +117,7 @@ it('should demonstrate how the links work', () => {
<TabItem value="dsl" label="DSL">

```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', () => {
Expand Down Expand Up @@ -150,7 +150,7 @@ it('should demonstrate how the links work', () => {
<TabItem value="dsl" label="DSL">

```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', () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/config/01-grouping/01-by-suite.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/config/01-grouping/02-by-story.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('Login controller', () => {
<TabItem value="dsl" label="DSL">

```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');
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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)',
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/config/01-grouping/03-by-package.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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('.'),
Expand Down

0 comments on commit 1ae4724

Please sign in to comment.