Skip to content
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

Fix Outstanding yarn jest and yarn lint Errors #184

Closed
5 of 6 tasks
thedavidprice opened this issue Mar 4, 2020 · 4 comments
Closed
5 of 6 tasks

Fix Outstanding yarn jest and yarn lint Errors #184

thedavidprice opened this issue Mar 4, 2020 · 4 comments
Assignees

Comments

@thedavidprice
Copy link
Contributor

thedavidprice commented Mar 4, 2020

This is a non-urgent issue that can wait until after March 10th milestone.

Our RedwoodJS tests have fallen behind and need some TLC. Related Issues:

Misc ToDo

  • linter and lint config should ignore all packagedist/* directories
@thedavidprice
Copy link
Contributor Author

Current yarn lint output:

$ yarn lint               
yarn run v1.22.0
$ yarn eslint 'packages/*/src/**/*.js'
$ /Users/price/Repos/redwoodjs-redwood/node_modules/.bin/eslint 'packages/*/src/**/*.js'
Warning: React version not specified in eslint-plugin-react settings. See https://github.com/yannickcr/eslint-plugin-react#configuration .
[eslint-import-resolver-babel-module] TypeError: Cannot read property 'plugins' of null
    at getPlugins (/Users/price/Repos/redwoodjs-redwood/node_modules/eslint-import-resolver-babel-module/lib/index.js:23:19)
    at getPluginOptions (/Users/price/Repos/redwoodjs-redwood/node_modules/eslint-import-resolver-babel-module/lib/index.js:35:21)
    at Object.exports.resolve (/Users/price/Repos/redwoodjs-redwood/node_modules/eslint-import-resolver-babel-module/lib/index.js:94:27)
    at v2 (/Users/price/Repos/redwoodjs-redwood/node_modules/eslint-module-utils/resolve.js:117:23)
    at withResolver (/Users/price/Repos/redwoodjs-redwood/node_modules/eslint-module-utils/resolve.js:122:16)
    at fullResolve (/Users/price/Repos/redwoodjs-redwood/node_modules/eslint-module-utils/resolve.js:139:22)
    at relative (/Users/price/Repos/redwoodjs-redwood/node_modules/eslint-module-utils/resolve.js:84:10)
    at resolve (/Users/price/Repos/redwoodjs-redwood/node_modules/eslint-module-utils/resolve.js:220:12)
    at resolveImportType (/Users/price/Repos/redwoodjs-redwood/node_modules/eslint-plugin-import/lib/core/importType.js:148:65)
    at computeRank (/Users/price/Repos/redwoodjs-redwood/node_modules/eslint-plugin-import/lib/rules/order.js:317:44)
See: https://github.com/tleunen/eslint-import-resolver-babel-module/pull/34
...

Current yarn jest output:

$ yarn jest        
yarn run v1.22.0
$ /Users/price/Repos/redwoodjs-redwood/node_modules/.bin/jest
jest-haste-map: duplicate manual mock found: @redwoodjs/internal
  The following files share their name; please delete one of them:
    * <rootDir>/packages/cli/__mocks__/@redwoodjs/internal.js
    * <rootDir>/packages/api/__mocks__/@redwoodjs/internal.js

 FAIL  packages/api/src/__tests__/fixtures/api/src/services/todos/todos.test.js
  • Test suite failed to run

    Your test suite must contain at least one test.

      at onResult (node_modules/@jest/core/build/TestScheduler.js:173:18)
          at async Promise.all (index 5)
      at async TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:260:11)
      at async runJest (node_modules/@jest/core/build/runJest.js:414:19)
      at async _run (node_modules/@jest/core/build/cli/index.js:371:7)
      at async runCLI (node_modules/@jest/core/build/cli/index.js:224:3)

 FAIL  packages/api/src/__tests__/fixtures/api/src/graphql/users.sdl.js
  • Test suite failed to run

    Your test suite must contain at least one test.

      at onResult (node_modules/@jest/core/build/TestScheduler.js:173:18)
          at async Promise.all (index 6)
      at async TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:260:11)
      at async runJest (node_modules/@jest/core/build/runJest.js:414:19)
      at async _run (node_modules/@jest/core/build/cli/index.js:371:7)
      at async runCLI (node_modules/@jest/core/build/cli/index.js:224:3)

 FAIL  packages/api/src/makeMergedSchema/makeMergedSchema.test.js
  • Test suite failed to run

    Cannot find module '../../../../src/main' from 'makeMergedSchema.test.js'

    > 1 | import { gql } from 'src/main'
        | ^
      2 | 
      3 | import { makeMergedSchema } from '../makeMergedSchema/makeMergedSchema'
      4 | 

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:276:11)
      at Object.<anonymous> (packages/api/src/makeMergedSchema/makeMergedSchema.test.js:1:1)

 FAIL  packages/api/src/__tests__/fixtures/api/src/graphql/posts.sdl.ts
  • Test suite failed to run

    Your test suite must contain at least one test.

      at onResult (node_modules/@jest/core/build/TestScheduler.js:173:18)
          at async Promise.all (index 7)
      at async TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:260:11)
      at async runJest (node_modules/@jest/core/build/runJest.js:414:19)
      at async _run (node_modules/@jest/core/build/cli/index.js:371:7)
      at async runCLI (node_modules/@jest/core/build/cli/index.js:224:3)

 FAIL  packages/api/src/__tests__/fixtures/api/src/services/todos/todos.js
  • Test suite failed to run

    Your test suite must contain at least one test.

      at onResult (node_modules/@jest/core/build/TestScheduler.js:173:18)
          at async Promise.all (index 4)
      at async TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:260:11)
      at async runJest (node_modules/@jest/core/build/runJest.js:414:19)
      at async _run (node_modules/@jest/core/build/cli/index.js:371:7)
      at async runCLI (node_modules/@jest/core/build/cli/index.js:224:3)

 FAIL  packages/api/src/__tests__/fixtures/api/src/services/posts.ts
  • Test suite failed to run

    Your test suite must contain at least one test.

      at onResult (node_modules/@jest/core/build/TestScheduler.js:173:18)
          at async Promise.all (index 8)
      at async TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:260:11)
      at async runJest (node_modules/@jest/core/build/runJest.js:414:19)
      at async _run (node_modules/@jest/core/build/cli/index.js:371:7)
      at async runCLI (node_modules/@jest/core/build/cli/index.js:224:3)

 FAIL  packages/api/src/__tests__/fixtures/api/src/services/users.js
  • Test suite failed to run

    Your test suite must contain at least one test.

      at onResult (node_modules/@jest/core/build/TestScheduler.js:173:18)
          at async Promise.all (index 9)
      at async TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:260:11)
      at async runJest (node_modules/@jest/core/build/runJest.js:414:19)
      at async _run (node_modules/@jest/core/build/cli/index.js:371:7)
      at async runCLI (node_modules/@jest/core/build/cli/index.js:224:3)

 FAIL  packages/cli/src/commands/dbCommands/__tests__/dbCommands.test.js
  • Test suite failed to run

    Cannot find module '../../../../../../src/lib' from 'dbCommands.test.js'

      1 | jest.mock('@redwoodjs/internal')
    > 2 | jest.mock('src/lib')
        |      ^
      3 | 
      4 | import { runCommandTask } from 'src/lib'
      5 | 

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:276:11)
      at Object.<anonymous> (packages/cli/src/commands/dbCommands/__tests__/dbCommands.test.js:2:6)

 PASS  packages/internal/src/__tests__/paths.test.ts
 FAIL  packages/internal/src/__tests__/fixtures/web/pages/HelloWorld/HelloWorld.js
  • Test suite failed to run

    Your test suite must contain at least one test.

      at onResult (node_modules/@jest/core/build/TestScheduler.js:173:18)
          at async Promise.all (index 13)
      at async TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:260:11)
      at async runJest (node_modules/@jest/core/build/runJest.js:414:19)
      at async _run (node_modules/@jest/core/build/cli/index.js:371:7)
      at async runCLI (node_modules/@jest/core/build/cli/index.js:224:3)

 FAIL  packages/internal/src/__tests__/fixtures/web/pages/Admin/MargleTheWorld/MargleTheWorld.js
  • Test suite failed to run

    Your test suite must contain at least one test.

      at onResult (node_modules/@jest/core/build/TestScheduler.js:173:18)
          at async Promise.all (index 14)
      at async TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:260:11)
      at async runJest (node_modules/@jest/core/build/runJest.js:414:19)
      at async _run (node_modules/@jest/core/build/cli/index.js:371:7)
      at async runCLI (node_modules/@jest/core/build/cli/index.js:224:3)

 FAIL  packages/cli/src/commands/test.js
  • Test suite failed to run

    Cannot find module '../../../../src/lib' from 'test.js'

      3 | import VerboseRenderer from 'listr-verbose-renderer'
      4 | 
    > 5 | import { getPaths } from 'src/lib'
        | ^
      6 | import c from 'src/lib/colors'
      7 | 
      8 | export const command = 'test [app..]'

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:276:11)
      at Object.<anonymous> (packages/cli/src/commands/test.js:5:1)

 PASS  packages/api/src/__tests__/importAll.macro.test.js
 PASS  packages/api/src/__tests__/graphQLServer.test.js
 FAIL  packages/cli/dist/commands/test.js
  • Test suite failed to run

    Your test suite must contain at least one test.

      at onResult (node_modules/@jest/core/build/TestScheduler.js:173:18)
          at async Promise.all (index 12)
      at async TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:260:11)
      at async runJest (node_modules/@jest/core/build/runJest.js:414:19)
      at async _run (node_modules/@jest/core/build/cli/index.js:371:7)
      at async runCLI (node_modules/@jest/core/build/cli/index.js:224:3)

Test Suites: 12 failed, 3 passed, 15 total
Tests:       6 passed, 6 total
Snapshots:   2 passed, 2 total
Time:        5.983s
Ran all test suites.
error Command failed with exit code 1.

@thedavidprice
Copy link
Contributor Author

All jest tests now pass. Lint runs without error but one warning remaining (willl open separate Issue).

Closing 🎉

@remjx
Copy link

remjx commented Mar 16, 2020

@thedavidprice can you point to the commit that includes these fixes?

@thedavidprice
Copy link
Contributor Author

@markjackson02 That was fast!

ESLint

Here's the hot-off-the-press PR #262 and related issue #258 (in master not yet published)

Lastest on Jest

Umbrella issue and some history #181
Recent PR with Bable config fix (published) #193
And current reported error #265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants