简体   繁体   English

在Mac OS X High Sierra上无法在没有sudo的情况下运行测试

[英]Cannot run tests without sudo on Mac OS X High Sierra

I'm having a very strange issue: 我遇到一个非常奇怪的问题:

Working on a project, which is a monorepo managed with lerna , I am unable to run tests for some reason unless I use sudo. 在一个由lerna管理的lerna项目中,除非出于某种原因,否则我将无法运行测试,除非使用sudo。 I know it is not a project configuration issue, because no one else on my team is experiencing this problem. 我知道这不是项目配置问题,因为团队中没有其他人遇到此问题。

The error, which is thrown immediately, ends up being: 立即引发的错误最终是:

Jest encountered an unexpected token
...
/Users/jasmar/dev/project/src/__setup__/setupTest.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { configure } from 'enzyme';

My environment is: 我的环境是:

  • Mac OS X High Sierra Mac OS X High Sierra
  • yarn (installed via brew) 纱线(通过冲泡安装)
  • Node 8.10.0 (via nvm; installed via curl) 节点8.10.0(通过nvm;通过curl安装)

I am an admin on the machine and have run sudo chmod -R ug+w . 我是计算机的管理员,并且已运行sudo chmod -R ug+w . against the project directory to no avail. 对项目目录无济于事。

I've also tried npm run test to no avail. 我也尝试过npm run test无济于事。

The test script that yarn runs is FORCE_COLOR=1 lerna --concurrency=4 run test and I have tried dropping concurrency to 1. yarn运行的测试脚本是FORCE_COLOR=1 lerna --concurrency=4 run test ,我尝试将并发性降低为1。

While running sudo yarn test does work, it is problematic as it generates new snapshots with incorrect permissions and makes managing version control extremely difficult. 尽管运行sudo yarn test确实可行,但存在问题,因为它会生成具有错误权限的新快照,并使版本控制的管理极为困难。

Any ideas would be hugely appreciated. 任何想法将不胜感激。

Thanks! 谢谢!

删除安装程序的下划线

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM