Comments (6)
Hi @mh21,
I suspect this has to do with the way your project folder is structured.
From the documentation:
This is the typical directory structure. Version 0.28.0 allows many of these to be changed by specifying options, supporting a more flexible directory structure.
<PROJECT-ROOT> directory ├─ .shellspec [mandatory] ├─ .shellspec-local [optional] Ignore from version control ├─ .shellspec-quick.log [optional] Ignore from version control ├─ report/ [optional] Ignore from version control ├─ coverage/ [optional] Ignore from version control │ ├─ bin/ │ ├─ your_script1.sh │ : ├─ lib/ │ ├─ your_library1.sh │ : │ ├─ spec/ (also <HELPERDIR>) │ ├─ spec_helper.sh [recommended] │ ├─ banner[.md] [optional] │ ├─ support/ [optional] │ │ │ ├─ bin/ │ │ ├─ your_script1_spec.sh │ │ : │ ├─ lib/ │ │ ├─ your_library1_spec.sh
As you can see, the spec
directory should be under the <PROJECT-ROOT>
directory, whereas yours is inside the bin
(in your case program1
) folder.
What you did is NOT a workaround, you just used the correct folder structure. 😃
Typically i use this structure:
<PROJECT-ROOT> directory
├─ spec/
│ ├─ test.spec.sh
├─ src/
│ ├─ mycode.sh
├─ .shellspec
├─ README.md
Solution n.1
If what you're trying topull off is a monorepo continue doing as you did in your "workaround".
Each new folder containing a new sub-project (i.e. program1
) should have its own .shellspec
file.
Solution n.2 (couldn't test)
If you really really need the original project structure (with only one .shellspec
file at the top) try to explicitly pass the test folder to shellspec
:
shellspec --kcov program1/spec/
from shellspec.
Just for some context, this is from https://gitlab.com/redhat/centos-stream/tests/kernel/kernel-tests. It is a repository of kernel tests used by Red Hat kernel QE. Different directories are different kernel tests, and having the spec directory (for testing the tests 🙈) next to the actual kernel tests makes a lot of sense for the QE folks that are individually only concerned with a subset of the kernel tests directories.
from shellspec.
Just for some context, this is from https://gitlab.com/redhat/centos-stream/tests/kernel/kernel-tests. It is a repository of kernel tests used by Red Hat kernel QE. Different directories are different kernel tests, and having the spec directory (for testing the tests 🙈) next to the actual kernel tests makes a lot of sense for the QE folks that are individually only concerned with a subset of the kernel tests directories.
WHAT?
Red Hat uses shellspec
???
This is news to me!
However... How did you manage to use kcov
?
I couldn't reproduce the bug since i can't install it 😞
Did you build it from source?
I'm using Windows 10 with WSL2.
from shellspec.
We started to use it in the CKI team (https://cki-project.org) which takes care of the Red Hat kernel CI infrastucture. And we are really really happy with it 🤗.
Examples: https://gitlab.com/cki-project/pipeline-definition/-/tree/main/spec
We run kcov in a Fedora Core container, e.g. via registry.gitlab.com/cki-project/cki-tools/cki-tools:production (which has shellspec/kcov already installed, https://gitlab.com/cki-project/containers/-/blob/main/includes/snippet-shellspec is what gets pulled into our Dockerfiles). My WSL2 skills are pretty rusty, so I'm not sure about the current way to run containers there 🙈.
from shellspec.
Thank you for your explanation! I'll close this issue, as it seems to be a problem on our end 🙈.
from shellspec.
Thank you for your explanation! I'll close this issue, as it seems to be a problem on our end 🙈.
Happy you were able to solve😄
What was the problem (if could be useful)?
from shellspec.
Related Issues (20)
- jUnit report is missing required attribute
- Provide a junit 5 config parameter to enable turn off adding stdout and stderr into the junit xml files.
- Intercepting the script as shown in documentation example isn't preserving the variables for "When run source" HOT 2
- does shellspec support csh or tcsh? HOT 1
- "Not found specified shell" in OpenBSD HOT 3
- Acronyms are not defined before use
- STDIN in test is bound to the calling terminal STDIN when Data block not specified HOT 2
- allow comparing stdout/stderr to the contents in a file HOT 2
- Pipping echo command prints to output HOT 2
- shellspec --init not working with whitespaces in working path on WSL Ubuntu on Windows HOT 4
- yash version 2.54 does not work with shellspec HOT 1
- kcov show no coverage with --execdir
- kcov with /bin/bash or /bin/sh HOT 1
- Command Based Mock - command execution status HOT 2
- Parameters:dynamic from a shell script HOT 1
- No error in execution without coverage report generation, problem in using coverage report generation
- Can local variables of the function under test be modified by the test case simulation? HOT 3
- Nested `source` commands inside scripts under testing
- Unit tests for Inner Function without calling the outer function HOT 1
- fails when expected success 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 shellspec.