This file is indexed.

/usr/lib/nodejs/test/test/fail-fast.js is in node-test 0.6.0-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"use strict";

var _assert = require("assert")
var run = require("../test").run
var Logger = require("./utils/logger").Logger



exports["test that passes"] = function (assert) {
    run({
      "test fixture": function () {
        _assert.equal(1, 1, "Must be equal")
      }
    }, Logger(function (passes, fails, errors) {
      assert.equal(passes.length, 1, "Must pass one test")
      assert.equal(fails.length, 0, "Must not fail any test")
      assert.equal(errors.length, 0, "Must not contain any errors")
    }))
}

exports["test that fails"] = function (assert) {
  run({
    "test fixture": function () {
      _assert.equal(1, 2, "Must be two")
    }
  }, Logger(function (passes, fails, errors) {
    assert.equal(passes.length, 0, "Must not pass any test")
    assert.equal(fails.length, 1, "Must fail one test")
    assert.equal(errors.length, 0, "Must not contain any errors")
  }))
}

exports["test that throws error"] = function (assert) {
  run({
    "test fixture": function () {
      throw new Error("Boom!!")
    }
  }, Logger(function (passes, fails, errors) {
    assert.equal(passes.length, 0, "Must not pass any test")
    assert.equal(fails.length, 0, "Must not fail any test")
    assert.equal(errors.length, 1, "Must contain one error")
  }))
}

exports["test that passes one assert and fails fast"] = function (assert) {
  run({
    "test fixture": function (assert) {
      assert.equal(1, 1, "Must be equal")
      _assert.equal(1, 2, "Must fail test")
    }
  }, Logger(function (passes, fails, errors) {
    assert.equal(passes.length, 1, "Must pass one test")
    assert.equal(fails.length, 1, "Must fail one test")
    assert.equal(errors.length, 0, "Must not contain any errors")
  }))
}

exports["test async with fast fail"] = function (assert) {
  run({
    "test:must throw": function (assert, done) {
      throw new Error("Boom!!")
    }
  }, Logger(function (passes, fails, errors) {
    assert.equal(passes.length, 0, "Must not pass any test")
    assert.equal(fails.length, 0, "Must not fail any test")
    assert.equal(errors.length, 1, "Must contain one error")
  }))
}

if (require.main === module)
  require("../test").run(exports)