c4lifa / jest-allure-circus Goto Github PK
View Code? Open in Web Editor NEWAllure reporting for newest Jest Circus v28.1
License: MIT License
Allure reporting for newest Jest Circus v28.1
License: MIT License
Pleases add Jest v29 support.
Question | Not clear - is it possible to add console.logs from jest and typescript?
We tried several ways, but it seems that it does not show the console.logs that are executed while the tests are running. Is this supported?
Also tried with this:
/**
Here is the logStep code
logStep(
name: string,
status: Status,
attachments?: Array<{name: string; content: string; type: ContentType | string | AttachmentOptions}>
): void {...}
Content should have types Buffer | string
, but it has only string
Using Jest 29- after configuring allure: Test environment jest-circus-allure cannot be found. Make sure the testEnvironment configuration option points to an existing node module
Jest throws and error
` Validation Error:
Test environment jest-circus-allure cannot be found. Make sure the testEnvironment configuration option points to an existing node module.
Configuration Documentation:
https://jestjs.io/docs/configuration`
You can run tests and allure without issues
Jest version: "ts-jest": "^29.0.3"
allure version: "jest-allure-circus": "^1.0.21",
Describe the bug: Cant install via Yarn - package not found
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Package installed
Screenshots
Error: error An unexpected error occurred: "https://registry.yarnpkg.com/jest-circus-allure: Not found".
Failed tests are ugly because text has ANSI escape codes.
Create simple test:
describe("Simple Test", () => {
it("must parse docblock", () => {
/** My test description.
* @epic Implement addition functionality
* @tag Accounting
*/
expect(1).toBe(2);
});
});
Error description doesn't contain ANSI escape codes.
Actual result:
Expected result:
I have this jest packages:
I have this error when running tests.
My jest config in package.json
{
"jest": {
"moduleFileExtensions": [
"ts",
"js"
],
"resetMocks": true,
"rootDir": "./",
"roots": [
"<rootDir>/src",
"<rootDir>/test"
],
"setupFilesAfterEnv": [
"jest-extended/all"
],
"testEnvironment": "jest-allure-circus",
"testEnvironmentOptions": {
"jiraUrl": "https://jira.example.com/browse/"
},
"testRegex": ".*\\.spec\\.ts$",
"testTimeout": 30000,
"transform": {
"^.+\\.ts$": "ts-jest"
}
}
}
Tests run without errors.
I have this jest packages:
Test fails when code contains waitForExpect
statement.
Create test:
import waitForExpect from "wait-for-expect";
describe("test", () => {
it("test", async () => {
await waitForExpect(() => {
console.log(1);
});
});
});
Test runs without errors.
I have this jest packages:
I'm using jest-playwright-preset to run playwright tests with the jest.
https://www.npmjs.com/package/jest-playwright-preset
But it has note in documentation:
Be sure to remove any existing testEnvironment option from your Jest configuration. The jest-playwright-preset preset needs to manage that option itself.
With jasmine2 reporter I used jest-allure which has different way to setup:
setupFilesAfterEnv: ["jest-allure/dist/setup"]
So is there any over options to setup allure reporter?
docblock pragmas doesn't exists in allure results.
Create simple test:
describe("Simple Test", () => {
it("must parse docblock", () => {
/** My test description.
* @epic Implement addition functionality
* @tag Accounting
*/
expect(1).toBe(1);
});
});
Test in allure results have epic
and tag
.
Actual result:
Expected result:
I have this jest packages:
Hello, could you please add a support for Allure + Circus + Puppeteer? I mean need an additional node which will include puppeteer setup.
const fs = require('fs');
const os = require('os');
const path = require('path');
const chalk = require('chalk');
const NodeEnvironment = require('jest-environment-node');
const puppeteer = require('puppeteer-core');
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
class PuppeteerEnvironment extends NodeEnvironment {
constructor(config) {
super(config);
}
async setup() {
await super.setup();
const wsEndpoint = fs.readFileSync(path.join(DIR, 'wsEndpoint'), 'utf8');
if (!wsEndpoint) {
throw new Error('wsEndpoint not found');
}
this.global.__BROWSER__ = await puppeteer.connect({
browserWSEndpoint: wsEndpoint,
defaultViewport: process.env.HEADLESS === 'true' ? { width: 1700, height: 1200 } : null,
});
}
async teardown() {
await super.teardown();
}
runScript(script) {
return super.runScript(script);
}
}
module.exports = PuppeteerEnvironment;
This repo contains both lock files from Yarn v1 (Classic) and npm <= 6.
I think we must choose one package manager and leave one lock file.
I suggest use Yarn Modern (v4 canary with a lot of improvements, see our template https://github.com/Byndyusoft/node-typescript-template as example). We successfully use it in public and private projects.
If you prefer npm, can you use npm v8 and update lock file to v2?
P.S. Impossible to use dependabot with Yarn Modern (see dependabot/dependabot-core#1297 for more details), but we always can use Renovate which is better than dependabot.
We dont have jest.setup.js only jest.config.js
Therefor we can't use the allure API, since we get error "error TS2304: Cannot find name 'allure'."
Whats configured?
// The test environment that will be used for testing
testEnvironment: 'jest-allure-circus',
// This option allows use of a custom test runner
'testRunner': 'jest-circus/runner',
Guideline on configuring allure with TS
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.