【问题标题】:Unable to run Jest tests. Getting Error unexpected token {无法运行 Jest 测试。获取错误意外令牌{
【发布时间】:2017-06-08 14:27:02
【问题描述】:

我无法使用 jest 运行测试。为反应应用程序编写测试。出现以下错误:-

node_modules\bootstrap\dist\css\bootstrap.min.css:5
     *//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css
 */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjus
t:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgrou
p,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{displa
y:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height
:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hove
r{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{fo
nt-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}
small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertic
al-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){ov
erflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;
-moz-box-sizing
SyntaxError: Unexpected token {

  at transformAndBuildScript (node_modules\jest-cli\node_modules\jest-runtim
e\build\transform.js:320:12)

【问题讨论】:

    标签: javascript jestjs babel-jest


    【解决方案1】:

    萨罗杰,

    您收到错误:“Unexpected token {”,因为您没有关闭您提供的示例中的最后一个花括号。只需在元素“hr”的最后一个 css 样式的末尾添加一个花括号,您将不再看到此错误。

        hr {height:0;
            -webkit-box-sizing:content-box;
            -moz-box-sizing
            }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-10
      • 1970-01-01
      • 2019-09-26
      • 1970-01-01
      • 2019-03-27
      • 2023-03-28
      • 1970-01-01
      • 2021-10-25
      相关资源
      最近更新 更多