-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: ENOENT: no such file or directory jest.results.json #8
Comments
I was getting same issue after following this link |
what fixed it for me was making sure all my jest deps were installed with a |
I am also having this issue, I tried
The pwd looks fine and the coverage is also fine. It feels like the plugin is executing in the context of the plugin instead of the project directory. Is there a setting that's missing in the action? Also, what is the required jest configuration because jest does not output |
Same error for me |
to fix this add
|
@mattallty this would be good in the instructions, together with a bit more info on "If you use Vue enable use_vue_cli: true" :D |
@mattallty need to be able to bypass |
Still have the same error.
|
I have tried using
Happens with this step (in a monorepo): - name: Coverage reporter with code annotations (for Github UI).
uses: mattallty/jest-github-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
working_directory: 'packages/app' And also this step (tweaked slightly - this is running in a Lerna monorepo): - name: Coverage reporter with code annotations (for Github UI).
uses: mattallty/jest-github-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
test-command: 'jest src --coverage --json --testLocationInResults --outputFile=jest.results.json' |
I confirm that this solved the - run: yarn install
- name: Jest Annotations & Coverage
uses: mattallty/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Same for me, however this seems to fix it: jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install modules
run: yarn
- name: Run tests
run: yarn jest --json --outputFile="jest.results.json"
- name: Add Coverage Comment
uses: mattallty/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
changes-only: true
test-command: "yarn jest" |
Same here. I was able to workaround by running the tests before this action, like hollandjake did. However, I updated the test command to be only a
|
Same here. It seems it cannot start any process. (There was an error when attempting to execute the process '/usr/bin/yarn') |
I think I've tried every variant above and nothing worked, but this does: jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: yarn install
- name: Run Tests
run: yarn jest --coverage --json --outputFile=/home/runner/work/_actions/mattallty/jest-github-action/v1/dist/jest.results.json
- uses: mattallty/jest-github-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
test-command: 'echo done'
|
@jake-nz @davidcalhoun @hollandjake I am getting the same error even with these fixes examples. have a look of my workflow: name: Tests
on:
pull_request:
branches:
- master
- development
jobs:
build:
runs-on: ubuntu-latest
container: node:14.17.1-alpine3.12
steps:
- name: Code checkout
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.npm
**/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-tests
restore-keys: |
${{ runner.os }}-node-tests
- name: Install dependencies
run: npm install
- name: Run lint
run: npm run lint
- name: Run test
run: npm run test:cov
- name: Run test
uses: mattallty/jest-github-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
coverage-comment: false
test-command: 'echo done' |
@ppamorim have you tried changing
to
|
@hollandjake |
This was happening because my test was causing a OOM. |
tldr; Your test script needs to look something like this: {
"scripts": {
"test:ci": "jest --runInBand"
}
} If it looks like this: {
"scripts": {
"test:ci": "run-s lint test:coverage",
"test:coverage": "jest --runInBand"
}
} It won't work. You can run stuff like linting in another action step. I got this working finally for myself. This is a totally MISLEADING error! The ENOENT error is a result of the test command failing. Unless your test script is able to accept extra Jest options (with a double dash in npm, none in yarn, ofc) like below, it will fail silently. npm run test:ci -- --testLocationInResults --json --coverage --outputFile="jest.results.json" Here's where the action script constructs a command like the one above: jest-github-action/src/action.ts Lines 150 to 163 in 12c8c9a
NPM will throw, but the action runner will continue and try to read the results file. The clue is that the action fails instantly. The tests don't have time to run, so something else must be happening. |
The following configuration worked for me: in package.json.
in workflow:
|
Hello @mattallty, I tried to use the Jest github-action as it is in the instructions. However, I get the following error every time. Can you please tell me what's going wrong here?
Best Peter
My Github action in general is configured like this:
The text was updated successfully, but these errors were encountered: