question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find module 'core-js/modules/es6.regexp.split'

See original GitHub issue

🐛 Bug Report

Using any of the modules provided my core-js/packages returns this error. Jest targets the old structure of core-js

Screen Shot 2019-05-20 at 11 34 22 PM

To Reproduce

  • yarn add core-js -D

defineStack.js

const defineStack = (stack) => {
  // Converting the exisiting string trace into an array
  stack = stack.split('\n');

  // Removing the first 2 elements of the array
  for (let i = 0; i < 3; ++i) {
    stack.shift();
  }

  // Returning the value of this.stack to the required stack trace
  return stack.join('\n').trim();
}

export default defineStack;

_tests_/defineStack.js

import defineStack from '../defineStack';

test('trims the stack and returns proper information', () => {
  console.log(defineStack);
});

Expected behavior

The tests should pass and log the function definition

Run npx envinfo --preset jest

  System:
    OS: macOS 10.14.4
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  Binaries:
    Node: 10.15.0 - /usr/local/bin/node
    Yarn: 1.16.0 - ~/.yarn/bin/yarn
    npm: 6.9.0 - ~/.npm-packages/bin/npm
  npmPackages:
    jest: ^24.8.0 => 24.8.0 

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
AndrewLeedhamcommented, May 23, 2019

@AmaanKulshreshtha Babel currently assumes you are using corejs@2. You should be able to add corejs: 3 to your @babel/preset-env options to fix this 😃

e.g.

{
  presets: [
    [
      '@babel/env',
      {
        targets: {
          // ...
        },
        useBuiltIns: 'usage',
        corejs: 3
      }
    ]
}
1reaction
SimenBcommented, May 23, 2019

We need babel to have test coverage and mocks, which is why it’s on by default.


You need it to live at the top level of node_modules. It being hoisted by the package manager is an implementation detail.


Jest has bundled babel-jest for ~10 versions


That said, this issue is about babel configuration, it’s not an issue with Jest.

Read more comments on GitHub >

github_iconTop Results From Across the Web

This dependency was not found: * core-js/modules/es6.regexp ...
This dependency was not found: * core-js/modules/es6.regexp.split ... Does anyone know how to resolve this? javascript · vue.js.
Read more >
re — Regular expression operations — Python 3.11.1 ...
This module provides regular expression matching operations similar to those found in Perl. Both patterns and strings to be searched can be Unicode...
Read more >
RegExp.prototype[@@split]() - JavaScript - MDN Web Docs
Integer specifying a limit on the number of splits to be found. The [@@split]() method still splits on every match of this RegExp...
Read more >
Regex.Split Method (System.Text.RegularExpressions)
Splits an input string into an array of substrings at the positions defined by a regular expression match.
Read more >
Perl split - to cut up a string into pieces
split REGEX, STRING, LIMIT where LIMIT is a positive number. This will split the the STRING at every match of the REGEX, but...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found