anchor.diff:    Both the compiler and karma continue to run. The compiler output is preceeded by `[0]`; 
     the karma output by `[1]`.
   
  +  编译器和`Karma`都会持续运行。编译器的输入信息前面有`[0]`，`Karma`的输出前面有`[1]`。
  +
     Change the expectation from `true` to `false`.
   
  +  将期望从`true`变换为`false`。
  +
     The _compiler_ watcher detects the change and recompiles.
  +
  +  **编译器**监视器检测到这个变化并重新编译。
   
   code-example(format="." language="bash").
     [0] 1:49:21 PM - File change detected. Starting incremental compilation...
  
positive.code:         An optional file that supplements the SystemJS configuration in `systemjs.config.js` with
          configuration for the specific needs of the application itself.
  
          A stock `systemjs.config.js` can't anticipate those needs. 
          You fill the gaps here.
  
          The sample version for this chapter adds the **model barrel**
          to the SystemJs `packages` configuration.
    tr
      td(colspan="2") 
        +makeExample('testing/ts/systemjs.config.extras.js', '', 'systemjs.config.extras.js')(format='.')
   
  :marked
    ### npm packages
  
    The sample tests are written to run in Jasmine and karma.
    The two "fast path" setups added the appropriate Jasmine and karma npm packages to the 
    `devDependencies` section of the `package.json`.
    They were installed when you ran `npm install`.
  
  .l-hr
  a#1st-karma-test
  :marked
    # The first karma test
  
    Start with a simple test to make sure the setup works properly.
  
    Create a new file called `1st.spec.ts` in the application root folder, `app/`
  
  .alert.is-important
    :marked
  
negative.code: :marked
    It failed of course.
  
    正如所料，测试结果是**失败**。
  
    Restore the expectation from `false` back to `true`.
    Both processes detect the change, re-run, and karma reports complete success.
  
    将期望从`false`恢复为`true`。两个进程都检测到这个变化，自动重新运行，`Karma`报告测试成功。
  
  .alert.is-helpful
    :marked
      The console log can be quite long. Keep your eye on the last line.
      It says `SUCCESS` when all is well.
  
      控制台的日志可能会非常长。注意最后一样。当一切正常时，它会显示`SUCCESS`。
      
      If it says `FAILED`, scroll up to look for the error or, if that's too painful,
      pipe the console output to a file and inspect with your favorite editor.
  
      如果它显示`FAILED`，往上翻查看错误。如果觉得这样太麻烦，你可以将控制台的输出内容导出到一个文件中，使用你最喜欢的编辑器查看。
    code-example(format="." language="json").
      npm test > spec-output.txt
  
  :marked
    ## Test debugging
    
    ## 调试测试
  
    Debug specs in the browser in the same way you debug an application.
  
    在浏览器中，像调试应用一样调试测试配置。
  
      - Reveal the karma browser window (hidden earlier).
  
      - 显示`Karma`的浏览器窗口（之前被隐藏了）。
  
      - Open the browser's “Developer Tools” (F12 or Ctrl-Shift-I).
  
      - 打开浏览器的“Developer Tools”(F12或者Ctrl-Shift-I)。
  
      - Pick the “sources” section
  
      - 选择“sources”页
  
      - Open the `1st.spec.ts` test file (Ctrl-P, then start typing the name of the file).
  
      - 打开`1st.spec.ts`测试文件（Ctrl-P, 然后输入文件名字）。
  
      - Set a breakpoint in the test
  
      - 在测试中设置一个断点。
  
      - Refresh the browser … and it stops at the breakpoint.
  
      - 刷新浏览器...然后它就会停在断点上。
   
  figure.image-display
    img(src='/resources/images/devguide/testing/karma-1st-spec-debug.png' style="width:700px;" alt="Karma debugging")
  
  a(href="#top").to-top Back to top
  a(href="#top").to-top 回到顶部
  
  .l-hr
  a#atp-intro
  