Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Testing debug-es/esm/browser with Jest #3

Closed
wrumsby opened this issue Sep 27, 2018 · 2 comments
Closed

Testing debug-es/esm/browser with Jest #3

wrumsby opened this issue Sep 27, 2018 · 2 comments
Assignees

Comments

@wrumsby
Copy link

wrumsby commented Sep 27, 2018

I'm trying to figure out how to test code that imports debug-es/esm/browser with Jest.

With my current config importing debug-es works, but importing debug-es/esm/browser doesn't.

.babelrc:

{
  "presets": [
      [
      "@babel/preset-env",
      {
        "modules": "commonjs",
        "useBuiltIns": "entry"
      }
    ]
  ]
}

jest.config.js:

module.exports = {
  verbose: true,
  testURL: 'http://localhost',
  cacheDirectory: `${__dirname}/.cache`,
  moduleDirectories: [
    '/examples',
    'node_modules'
  ],
  moduleFileExtensions: [
    'js',
    'mjs'
  ],
  testMatch: [
    '**/*.test.js'
  ],
  transformIgnorePatterns: [
    '/node_modules/(?!debug-es)'
  ]
}

dependencies and devDependencies from package.json:

{
  "dependencies": {
    "debug-es": "^1.2.3"
  },
  "devDependencies": {
    "@babel/core": "^7.1.0",
    "@babel/preset-env": "^7.1.0",
    "babel-core": "^7.0.0-bridge.0",
    "jest": "^23.6.0",
    "jsdom": "^12.0.0"
  }
}
@miaulightouch
Copy link
Member

sorry for misunderstanding, pls follow this comment to change your config:
jestjs/jest#6229 (comment)

@miaulightouch
Copy link
Member

miaulightouch commented Sep 30, 2018

and I notice you miss babel-jest in your devDependencies

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

No branches or pull requests

2 participants