Comments (4)
When working with an Nx monorepo you don't call the Jest CLI yourself. Instead you call the Nx CLI and it starts multiple Jest processes at once, one for each of the packages in your monorepo.
By default all of these Jest processes share a single Jest base config file, and therefore share a single jest-junit configuration too, meaning their file names can't be hard-coded into their config. That's why I'd like the ability to interpolate the Jest display name into the file name.
If you include jest-junit in an Nx monorepo with its default config in the Jest base config then you get N
number of Jest processes all start at once with the same jest-junit config, all writing to the same output file. All 15 processes write to the file ./junit.xml
and overwrite each other. You're left with a single file that only contains the output from the longest running process.
Right now I have a jest-junit config that looks something like:
reporters: [
"default",
[
"jest-junit",
{
suiteName: "<name of my monorepo>",
suiteNameTemplate: "{filepath}",
uniqueOutputName: "true",
outputName: "junit",
outputDirectory: "reports"
}
]
]
This is pretty good, I end up with N
number of files in a reports
directory but there's no way to tie them back to the library in the monorepo that they came from - the names are just random.
I think it would be ideal if a monorepo with a structure like
jest.base.ts
libs/
project-one/
package.json
src/
index.ts
test/
index.spec.ts
project-two/
package.json
src/
index.ts
test/
index.spec.ts
was able to produce a reports directory like
reports/
project-one-junit.xml
project-two-junit.xml
Which is what interpolating the display name into the file name would give me.
Does that help explain my situation?
Let me know if you have more questions :)
from jest-junit.
Hey!
I like the idea but I'm not sure if it would work in practice.
displayName is used to signify different jest projects, but the jest runner will also run them all by default.
So if multiple jest projects are run then it would get confusing and possibly unpredictable what the filename would be.
from jest-junit.
Hey thanks that helps a lot.
My main point in bringing this up is that most of the people who rely on jest-junit don't have that structure. So if you add the feature make sure to make a note in the docs that this is only for situations where jest projects are run independently.
from jest-junit.
Great yeah OK, can do :)
from jest-junit.
Related Issues (20)
- Getting "extra" testcases, one "correct", another with just a Test Execution Failure HOT 3
- [Question] include console log as a system.out to the junit report. HOT 1
- Handle boolean values in addition to strings within config HOT 2
- Feature Request: Add `line` attribute to `<testcase>` element HOT 5
- Feature request: Support for test case properties HOT 4
- Can't run jest-junit as a reporter HOT 2
- Feature Request: Mark 'todo' tests as 'skipped' HOT 3
- jest-junit incorrectly merges 2 test suites HOT 8
- Feature Request: Allow adding custom properties to `<testcase>` HOT 2
- ERR_REQUIRE_ESM HOT 2
- I have a Create React App and am trying to get unit test running in an Azure pipeline. HOT 1
- I didnt find jest-junit latest version updated with latest strip ansi 7.0.1
- Feature request: attribute retry HOT 1
- Add <rootDir> expansion to `filePathPrefix`
- Feature Request: Injection values in outputName HOT 3
- Failed to write coverage reports: HOT 4
- Report is not generated when using --forceExit
- Code Coverage not included in JUnit Report HOT 2
- Line coverage in jest-junit report HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jest-junit.