Giter VIP home page Giter VIP logo

jest-teamcity's Introduction

jest-teamcity

Build Status Package Verifier

TeamCity Reporter for Jest testing framework which groups tests using TeamCity Test Suites.

Features

  • grouping tests by test suites
  • output tests duration
  • output pending, failed test with message and stack

Install

Install with npm: npm install --save-dev jest-teamcity

Usage

Add this into the jest configuration file:

"reporters": ["default", "jest-teamcity"]

The reporter is enabled only if TEAMCITY_VERSION environment variable is set. It should work in TeamCity by default.

To be able to run the tests with the reporter locally, environment variable should be set:

export TEAMCITY_VERSION="some_version"

Package.json example:

"scripts": {
    "test": "jest"
}

With this configuration, you can run the tests with npm test. If the TEAMCITY_VERSION environment variable is set, it produces the output in TeamCity's format. Otherwise, standard jest output is produced.

License

MIT © [Ivan Tereshchenkov]

jest-teamcity's People

Contributors

abobr avatar dependabot[bot] avatar hypnosphi avatar itereshchenkov avatar ivan-vdovin avatar jgoz avatar marcello3d avatar mm-dsibinski avatar scinos avatar yurynix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jest-teamcity's Issues

Access to jest-teamcity results?

Hi,

TeamCity allows me to download the jest-teamcity test results (test duration, etc) as a CSV file. Is there a way to access this information in a build step, or at least convert it to an artifact?

I'd like to automatically collect results across builds and make some comparisons.

Thank you...

Plugin doesn't work at all with configuration added to package.json

Environment: Windows 10
jest-teamcity version: 1.9.0
TeamCity version: TeamCity Professional 2020.2.4 (build 86063)

Issue:
I installed the npm package, added this to my package.json:

"jest": {
        "reporters": ["default", "jest-teamcity"]
    }

and I use the npm test command defined as "test": "jest" in package.json to run my tests. The result on TeamCity server is standard text output, the same like without the plugin. The tests are also not included in TeamCity's tests results.

I also tried to set the environment variable in Windows TEAMCITY_VERSION (both as system variable and user variable), but when I execute npm test locally with this variable defined the output is still standard, not the TeamCity one.

Solution:
I found out that adding this configuration to package.json doesn't work anymore. It only worked for me when I added the configuration to jest's configuration file.

I issued a PR with the documentation update: #20

Suggestion: Option for creating overall suite

I work on an Angular app and just recently converted it from jasmine + karma to Jest. I added this package to help report the test to our TeamCity server and it is working great!

However, we are in a mono repo with multiple different projects, some in TS/JS, some in C#, so we would like to be able to separate these tests from tests of other projects - currently, our TeamCity looks something like this:

Name Other info...
WebApi Tests ...
Playwright Tests ...
<38 suites for UI tests...> ...

If possible, we would love an option that would turn this into:

Name Other info...
WebApi Tests ...
Playwright Tests ...
UI Tests ...

Where the UI Tests would contain the 38 suites.
I would go for path-based sorting as explained below, but any solution that would allow me to group the tests is what I am asking for.

Path-based sorting
Suite: name given in config
Namespace/package: path[0..-1].Join('.')
Class: path[-1]
Test: as is

Error on running jest-teamcity

Hello, I am getting below error on running our Jest Unit tests for our vue js app via teamcity.

Trace: The node type SpreadProperty has been renamed to SpreadElement
      at Object.isSpreadProperty (D:\BuildAgent\work\87cb20bee7187581\SMA Web\SMA.Web\node_modules\@babel\core\node_modules\@babel\types\lib\validators\generated\index.js:4304:11)
      at hasSpread (D:\BuildAgent\work\87cb20bee7187581\SMA Web\SMA.Web\node_modules\babel-plugin-transform-object-rest-spread\lib\index.js:38:13)
      at PluginPass.ObjectExpression (D:\BuildAgent\work\87cb20bee7187581\SMA Web\SMA.Web\node_modules\babel-plugin-transform-object-rest-spread\lib\index.js:234:14)
      at newFn (D:\BuildAgent\work\87cb20bee7187581\SMA Web\SMA.Web\node_modules\@babel\core\node_modules\@babel\traverse\lib\visitors.js:193:21)
      at NodePath._call (D:\BuildAgent\work\87cb20bee7187581\SMA Web\SMA.Web\node_modules\@babel\core\node_modules\@babel\traverse\lib\path\context.js:53:20)
      at NodePath.call (D:\BuildAgent\work\87cb20bee7187581\SMA Web\SMA.Web\node_modules\@babel\core\node_modules\@babel\traverse\lib\path\context.js:40:17)
      at NodePath.visit (D:\BuildAgent\work\87cb20bee7187581\SMA Web\SMA.Web\node_modules\@babel\core\node_modules\@babel\traverse\lib\path\context.js:88:12)
      at TraversalContext.visitQueue (D:\BuildAgent\work\87cb20bee7187581\SMA Web\SMA.Web\node_modules\@babel\core\node_modules\@babel\traverse\lib\context.js:118:16)
      at TraversalContext.visitSingle (D:\BuildAgent\work\87cb20bee7187581\SMA Web\SMA.Web\node_modules\@babel\core\node_modules\@babel\traverse\lib\context.js:90:19)
      at TraversalContext.visit (D:\BuildAgent\work\87cb20bee7187581\SMA Web\SMA.Web\node_modules\@babel\core\node_modules\@babel\traverse\lib\context.js:146:19)

Also If I run it from cmd from the build agent directly, I can see tests running though,

Can you help me what could be the issue ?

--teamcity command line option is unrecognized

I get the following error when using this:

[15:10:55][Step 1/1] $ jest --config=src/react/jest.config.json --verbose --teamcity
[15:10:56][Step 1/1] C:\BuildAgent\work\e49c7465ca0ba2a8\KvK.Internet.Web\node_modules\jest-util\build\validateCLIOptions.js:63
[15:10:56][Step 1/1] throw createCLIValidationError(unrecognizedOptions, allowedOptions);
[15:10:56][Step 1/1] ^
[15:10:56][Step 1/1]
[15:10:56][Step 1/1] â—� Unrecognized CLI Parameter:
[15:10:56][Step 1/1]
[15:10:56][Step 1/1] Unrecognized option "teamcity".
[15:10:56][Step 1/1]
[15:10:56][Step 1/1] CLI Options Documentation:
[15:10:56][Step 1/1] http://facebook.github.io/jest/docs/cli.html
[15:10:56][Step 1/1]
[15:10:56][Step 1/1] error Command failed with exit code 1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.