Error in jest dep. during serverless npm build
See original GitHub issue🐛 Bug Report
Hello, I’m trying to build a project which have jest as dependency. It’s a Create React App based project. I’m building the process through a serverless CI/CD for AWS Lambda environment (it launches a simple npm i / npm run build). Two days ago I successfully deployed the project with no errors. Today I’m getting an error during the build process at the following line in the jest-diff module:
import type { DiffOptions } from './types';
In the package.json file I’ve got the following dependencies configuration:
- TypeScript version 3.5.2
- Jest: 24.0.15
the same configuration of the last succesful build of two days ago. I encounter the problem only in the AWS infrastructure, not locally. Thanks in advance.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top Results From Across the Web
npm install errors with Error: ENOENT, chmod - Stack Overflow
I noticed that the error had to do with the file I am linking to the path, specifically when npm tried to do...
Read more >depcheck - npm
Depcheck is a tool for analyzing the dependencies in a project to see: how each dependency is used, which dependencies are useless, and...
Read more >Unit testing for Node.js Serverless projects with Jest
Create unit tests for Node.js using the Serverless Framework, run tests on CI, ... I'm a huge Jest fan when it comes to...
Read more >Troubleshooting - Puppeteer
PUPPETEER_CACHE_DIR=$(pwd) npm install puppeteer ... Lastly, if you're using Puppeteer through Jest, then you may encounter an error spawning child ...
Read more >Unit Tests in Serverless - SST.Dev - Netlify
However, if you are starting a new Serverless Framework project, add Jest to your dev dependencies by running the following. Copy $ npm...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jberube we don’t control
@types/jest
, feel free to raise the issue there 😃@thymikee
jest-diff@26.0.1
is imported from@types/jest@24.0.15
(see below).That caused my project to break with the error mentioned in OP.
Upgrading to
typescript@3.8
comes with a host of issues in some projects, since not all libraries supports it well at the moment. In my case, jest wasn’t importing non-ES5 or non-js modules correctly usingreact-scripts@3.4.1
with default configurations after updating totypescript@3.8
.As a workaround, downgrading jest-diff@24.9.0 works pretty well.@types/jest-diff@24.x
probably shouldn’t importjest-diff@26.0.1
and importjest-diff@24.9.0
instead.EDIT: updating
@types/jest@24.9.1
work and is clean. My types were out of date. My bad 😛