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

test failures with new joi@17.8.x dependency #107

Closed
shazron opened this issue Feb 20, 2023 · 1 comment
Closed

test failures with new joi@17.8.x dependency #107

shazron opened this issue Feb 20, 2023 · 1 comment
Assignees

Comments

@shazron
Copy link
Member

shazron commented Feb 20, 2023

Workaround is to pin joi@17.7.1. 17.8.0 and 17.8.1 makes this fail.

 FAIL  test/init.test.js
  ● Test suite failed to run

    Cannot find module '@hapi/hoek/assert' from 'index.js'

      11 | */
      12 |
    > 13 | const TvmClient = require('@adobe/aio-lib-core-tvm')
         |                   ^
      14 | const logger = require('@adobe/aio-lib-core-logging')('@adobe/aio-lib-files', { provider: 'debug' })
      15 |
      16 | const utils = require('./utils')

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:259:17)
      at Object.<anonymous> (node_modules/joi/lib/index.js:3:16)
      at Object.<anonymous> (node_modules/@adobe/aio-lib-core-tvm/lib/TvmClient.js:13:13)
      at Object.<anonymous> (lib/init.js:13:19)
      at Object.<anonymous> (test/init.test.js:13:18)

 FAIL  test/Files.test.js
  ● Test suite failed to run

    Cannot find module '@hapi/hoek/assert' from 'index.js'

    However, Jest was able to find:
    	'../lib/Files.js'

    You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'jsx', 'ts', 'tsx', 'node'].

    See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string

      13 | const upath = require('upath')
      14 | const fs = require('fs-extra')
    > 15 | const joi = require('joi')
         |             ^
      16 | const stream = require('stream')
      17 | const cloneDeep = require('lodash.clonedeep')
      18 | const logger = require('@adobe/aio-lib-core-logging')('@adobe/aio-lib-files', { provider: 'debug' })

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:259:17)
      at Object.<anonymous> (node_modules/joi/lib/index.js:3:16)
      at Object.<anonymous> (lib/Files.js:15:13)
      at Object.<anonymous> (test/Files.test.js:2:45)

 FAIL  test/impl/AzureBlobFiles.test.js
  ● Test suite failed to run

    Cannot find module '@hapi/hoek/assert' from 'index.js'

    However, Jest was able to find:
    	'../../lib/impl/AzureBlobFiles.js'

    You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'jsx', 'ts', 'tsx', 'node'].

    See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string

      14 |
      15 | const azure = require('@azure/storage-blob')
    > 16 | const joi = require('joi')
         |             ^
      17 | const stream = require('stream')
      18 | const mime = require('mime-types')
      19 | const fetch = require('node-fetch')

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:259:17)
      at Object.<anonymous> (node_modules/joi/lib/index.js:3:16)
      at Object.<anonymous> (lib/impl/AzureBlobFiles.js:16:13)
      at Object.<anonymous> (test/impl/AzureBlobFiles.test.js:22:28)

--------------------|----------|----------|----------|----------|-------------------|
File                |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
--------------------|----------|----------|----------|----------|-------------------|
All files           |        0 |        0 |        0 |        0 |                   |
 lib                |        0 |        0 |        0 |        0 |                   |
  Files.js          |        0 |        0 |        0 |        0 |... 57,858,862,864 |
  FilesError.js     |        0 |        0 |        0 |        0 |... 48,49,50,51,53 |
  init.js           |        0 |        0 |        0 |        0 |... 64,66,67,68,76 |
  utils.js          |        0 |        0 |        0 |        0 |... 25,26,29,34,37 |
 lib/impl           |        0 |        0 |        0 |        0 |                   |
  AzureBlobFiles.js |        0 |        0 |        0 |        0 |... 26,628,638,642 |
--------------------|----------|----------|----------|----------|-------------------|
Jest: "global" coverage threshold for statements (100%) not met: 0%
Jest: "global" coverage threshold for branches (100%) not met: 0%
Jest: "global" coverage threshold for lines (100%) not met: 0%
Test Suites: 3 failed, 3 total
Tests:       0 total
Snapshots:   0 total
Time:        1.326s
Ran all test suites.
@shazron shazron changed the title test failures with new joi dependency test failures with new joi@17.8.x dependency Feb 20, 2023
@amulyakashyap09 amulyakashyap09 self-assigned this Feb 20, 2023
@shazron
Copy link
Member Author

shazron commented Feb 20, 2023

This is a module exports resolver issue with Jest. The issue is fixed by upgrading to jest@28 or greater.

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

No branches or pull requests

2 participants