hipstersmoothie/jest-github-reporter

Error: Could not resolve a module for a custom reporter. Module name: ./dist/index.js

moop-moop opened this issue · 11 comments

I think I am missing something form the Usage instructions.
I installed the Github App.

What does this mean?

Only runs in CI environment

Does this mean that a Github workflow action to test is required?

That did not work for me either.

> npx jest
Error: Could not resolve a module for a custom reporter.
  Module name: ./dist/index.js
    at C:\Users\***\GitHub\next-netlify-jest-testing\node_modules\jest-config\build\normalize.js:557:15
    at Array.map (<anonymous>)
    at normalizeReporters (C:\Users\***\GitHub\next-netlify-jest-testing\node_modules\jest-config\build\normalize.js:539:33)
    at normalize (C:\Users\***\GitHub\next-netlify-jest-testing\node_modules\jest-config\build\normalize.js:632:5)
    at readConfig (C:\Users\***\GitHub\next-netlify-jest-testing\node_modules\jest-config\build\index.js:220:68)
    at async readConfigs (C:\Users\***\GitHub\next-netlify-jest-testing\node_modules\jest-config\build\index.js:400:26)
    at async runCLI (C:\Users\***\GitHub\next-netlify-jest-testing\node_modules\@jest\core\build\cli\index.js:198:59)
    at async Object.run (C:\Users\***\GitHub\next-netlify-jest-testing\node_modules\jest\node_modules\jest-cli\build\cli\index.js:163:37)

Removing ./dist/index.js from the reporters, removed the error, but nothing was annotated in any environment CI or otherwise.

Those docs are def off. try adding jest-github-reporter to the reporters array

I can't see that build. do you run linting while in netlify?

Only runs in CI environment

This means when you run jest locally this reporter does nothing.

https://github.com/hipstersmoothie/create-check/blob/master/src/index.ts#L95

The problem seems to be the library we rely on doesn't count netlify as a CI provider https://github.com/pvdlg/env-ci/tree/master/services

I'm not too sure but I don't think it's common for netlify to run this type of stuff? That is usually something circleci or travis (or anything thats on that list) runs.

PR is pending. semantic-release/env-ci#126 go there and add some reactions

The problem seems to be the library we rely on doesn't count netlify as a CI provider https://github.com/pvdlg/env-ci/tree/master/services

I'm not too sure but I don't think it's common for netlify to run this type of stuff? That is usually something circleci or travis (or anything thats on that list) runs.

Netlify is NOW supporting build plugins, this reporter seems perfect for use with it.

I can't see that build. do you run linting while in netlify?

Sorry, I thought the log was public, no liniting was done for this in Netlify on this run.

I can't see that build. do you run linting while in netlify?

Sorry, I thought the log was public, no liniting was done for this in Netlify on this run.

6:47:30 PM: Build ready to start
6:47:32 PM: build-image version: 30f629161c0736b1a3ecd8b418e5eeffab5c0faf
6:47:32 PM: build-image tag: v3.3.14
6:47:32 PM: buildbot version: c59536cd5af8d84bd2f02c6af4027561b250018a
6:47:32 PM: Fetching cached dependencies
6:47:32 PM: Starting to download cache of 315.1MB
6:47:34 PM: Finished downloading cache in 1.822880451s
6:47:34 PM: Starting to extract cache
6:47:55 PM: Finished extracting cache in 20.60821405s
6:47:55 PM: Finished fetching cache in 23.07938837s
6:47:55 PM: Starting to prepare the repo for build
6:47:56 PM: Preparing Git Reference pull/1/head
6:47:57 PM: Found Netlify configuration file netlify.toml in site root
6:47:57 PM: Found Netlify configuration file(s). Overriding site configuration
6:47:57 PM: Different functions path detected, going to use the one specified in the Netlify configuration file: 'serverless' versus '' in the Netlify UI
6:47:57 PM: Creating functions prep folder
6:47:57 PM: Starting build script
6:47:57 PM: Installing dependencies
6:47:58 PM: Started restoring cached node version
6:48:01 PM: Finished restoring cached node version
6:48:01 PM: Attempting node version '12.16.2' from .nvmrc
6:48:03 PM: v12.16.2 is already installed.
6:48:04 PM: Now using node v12.16.2 (npm v6.14.4)
6:48:04 PM: Started restoring cached build plugins
6:48:04 PM: Finished restoring cached build plugins
6:48:04 PM: Attempting ruby version 2.6.2, read from environment
6:48:06 PM: Using ruby version 2.6.2
6:48:07 PM: Using PHP version 5.6
6:48:07 PM: 5.2 is already installed.
6:48:07 PM: Using Swift version 5.2
6:48:07 PM: Started restoring cached node modules
6:48:07 PM: Finished restoring cached node modules
6:48:07 PM: Installing NPM modules using NPM version 6.14.4
6:48:25 PM: npm WARN
6:48:25 PM:  bootstrap@4.5.0 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
6:48:25 PM: npm WARN
6:48:25 PM:  eslint-config-airbnb@18.1.0 requires a peer of eslint@^5.16.0 || ^6.8.0 but none is installed. You must install peer dependencies yourself.
6:48:25 PM: npm WARN
6:48:25 PM:  eslint-config-airbnb@18.1.0 requires a peer of eslint-plugin-react-hooks@^2.5.0 || ^1.7.0 but none is installed. You must install peer dependencies yourself.
6:48:25 PM: npm
6:48:25 PM:  WARN eslint-config-airbnb-base@14.1.0 requires a peer of eslint@^5.16.0 || ^6.8.0 but none is installed. You must install peer dependencies yourself.
6:48:25 PM: npm
6:48:25 PM: WARN eslint-plugin-import@2.20.2 requires a peer of eslint@2.x - 6.x but none is installed. You must install peer dependencies yourself.
6:48:25 PM: npm WARN
6:48:25 PM:  eslint-plugin-jsx-a11y@6.2.3 requires a peer of eslint@^3 || ^4 || ^5 || ^6 but none is installed. You must install peer dependencies yourself.
6:48:25 PM: npm
6:48:25 PM:  WARN eslint-plugin-react@7.19.0 requires a peer of eslint@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
6:48:25 PM: npm
6:48:25 PM: WARN inquirer-autocomplete-prompt@1.0.2 requires a peer of inquirer@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
6:48:25 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
6:48:25 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
6:48:25 PM: npm WARN
6:48:25 PM: optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack/node_modules/fsevents):
6:48:25 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
6:48:25 PM: npm
6:48:25 PM: WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/react-dev-utils/node_modules/fsevents):
6:48:25 PM: npm WARN
6:48:25 PM: notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
6:48:25 PM: npm WARN optional
6:48:25 PM:  SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/next/node_modules/fsevents):
6:48:25 PM: npm WARN
6:48:25 PM: notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
6:48:25 PM: added 48 packages from 20 contributors and audited 2952 packages in 16.98s
6:48:27 PM: 104 packages are looking for funding
6:48:27 PM:   run `npm fund` for details
6:48:27 PM: found 7 high severity vulnerabilities
6:48:27 PM:   run `npm audit fix` to fix them, or `npm audit` for details
6:48:27 PM: NPM modules installed
6:48:28 PM: Started restoring cached go cache
6:48:28 PM: Finished restoring cached go cache
6:48:28 PM: go version go1.12 linux/amd64
6:48:28 PM: go version go1.12 linux/amd64
6:48:28 PM: Installing missing commands
6:48:28 PM: Verify run directory
6:48:28 PM: Executing user command: npm run test && npm run build
6:48:28 PM: > next-netlify-template@0.1.0 test /opt/build/repo
6:48:28 PM: > jest
6:48:32 PM: FAIL src/components/HelloWorld/HelloWorld.test.js
6:48:32 PM:   <HelloWorld />
6:48:32 PM:     <HelloWorld /> renders correctly
6:48:32 PM:       ✕ it says Hello World in the h1 (35 ms)
6:48:32 PM:   ● <HelloWorld /><HelloWorld /> renders correctly › it says Hello World in the h1
6:48:32 PM:     expect(received).toBe(expected) // Object.is equality
6:48:32 PM:     Expected: "mockContent.headings"
6:48:32 PM:     Received: "Hello world"
6:48:32 PM:       13 |       const { heading } = mockContent;
6:48:32 PM:       14 |       const { getByTestId } = render(<HelloWorld heading={heading} />);
6:48:32 PM:     > 15 |       expect(getByTestId('HelloWorld-heading').textContent).toBe('mockContent.headings');
6:48:32 PM:          |                                                             ^
6:48:32 PM:       16 |     });
6:48:32 PM:       17 |   });
6:48:32 PM:       18 | });
6:48:32 PM:       at Object.<anonymous> (src/components/HelloWorld/HelloWorld.test.js:15:61)
6:48:32 PM: Test Suites: 1 failed, 1 total
6:48:32 PM: Tests:       1 failed, 1 total
6:48:32 PM: Snapshots:   0 total
6:48:32 PM: Time:        1.987 s
6:48:32 PM: Ran all test suites.
6:48:32 PM: npm ERR!
6:48:32 PM:  code ELIFECYCLE
6:48:32 PM: npm ERR! errno
6:48:32 PM:  1
6:48:32 PM: npm ERR!
6:48:32 PM:  next-netlify-template@0.1.0 test: `jest`
6:48:32 PM: npm ERR! Exit status 1
6:48:32 PM: npm
6:48:32 PM:  ERR!
6:48:32 PM: npm ERR!
6:48:32 PM:  Failed at the next-netlify-template@0.1.0 test script.
6:48:32 PM: npm
6:48:32 PM: ERR! This is probably not a problem with npm. There is likely additional logging output above.
6:48:32 PM: npm
6:48:32 PM:  ERR! A complete log of this run can be found in:
6:48:32 PM: npm
6:48:32 PM:  ERR!     /opt/buildhome/.npm/_logs/2020-05-26T23_48_32_291Z-debug.log
6:48:32 PM: Function Dir: /opt/build/repo/serverless
6:48:32 PM: TempDir: /tmp/zisi-5ecdaa9202798400075b6bd3
6:48:33 PM: Prepping functions with zip-it-and-ship-it 0.4.0-18
6:48:35 PM: [
6:48:35 PM:   {
6:48:35 PM:     "path": "/tmp/zisi-5ecdaa9202798400075b6bd3/hello-world.zip",
6:48:35 PM:     "runtime": "js"
6:48:35 PM:   }
6:48:35 PM: ]
6:48:35 PM: Prepping functions complete
6:48:35 PM: Caching artifacts
6:48:35 PM: Started saving node modules
6:48:35 PM: Finished saving node modules
6:48:35 PM: Started saving build plugins
6:48:35 PM: Finished saving build plugins
6:48:35 PM: Started saving pip cache
6:48:45 PM: Finished saving pip cache
6:48:45 PM: Started saving emacs cask dependencies
6:48:45 PM: Finished saving emacs cask dependencies
6:48:45 PM: Started saving maven dependencies
6:48:45 PM: Finished saving maven dependencies
6:48:45 PM: Started saving boot dependencies
6:48:45 PM: Finished saving boot dependencies
6:48:45 PM: Started saving go dependencies
6:48:45 PM: Finished saving go dependencies
6:48:45 PM: Error running command: Build script returned non-zero exit code: 1
6:48:45 PM: Failing build: Failed to build site
6:48:45 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
6:48:45 PM: Finished processing build request in 1m12.580576285s

@hipstersmoothie
I was able to fake Netlify as a CI by using these environment variables in Netlify:

  • CI: true
  • OWNER: < our GitHub org >
  • REPO: <build repo's name >

CI true overrides and makes isCi true.

And I was able to get a simple Status under "Jest Results" - Test: Jest Results -- Your project seems to have errors.

The annotations parsing is not working though (testing locally seems to yield empty annotations arrays), not sure if its related to the Netlify/CI issue. But suspect the test results may not be parsing correctly.

I have attached an example single test, single failure JSON formatted result. Any ideas?

failed_test.json.txt