anchor.diff:      if (jsFile.existsSync()) {
         jsFile.deleteSync();
       }
  -
  -    // There are errors, so delete any stale expect ".js" file.
  -    if (expectFile.existsSync()) {
  -      expectFile.deleteSync();
  -    }
  -    expectFile.writeAsStringSync("//FAILED TO COMPILE");
  +  }
  +
  +  // Write the expectation file if needed.
  +  // Generally speaking we try to avoid these tests, but they are occasionally
  +  // useful.
  +  if (expectPath != null) {
  +    _ensureDirectory(path.dirname(expectPath));
  +
  +    var expectFile = new File(expectPath + '.js');
  +    if (result.isValid) {
  +      expectFile.writeAsStringSync(result.code);
  +    } else {
  +      // There are errors, so delete any stale expect ".js" file.
  +      if (expectFile.existsSync()) {
  +        expectFile.deleteSync();
  +      }
  +      expectFile.writeAsStringSync("//FAILED TO COMPILE");
  +    }
     }
   }
   
  
positive.code: 
  void _writeModule(String outPath, String expectPath, JSModuleFile result) {
    _ensureDirectory(path.dirname(outPath));
    _ensureDirectory(path.dirname(expectPath));
  
    String errors = result.errors.join('\n');
    if (errors.isNotEmpty && !errors.endsWith('\n')) errors += '\n';
  
negative.code: 
    var jsFile = new File(outPath + '.js');
    var summaryFile = new File(outPath + '.sum');
    var errorFile = new File(outPath + '.err');
  
    if (result.isValid) {
  