• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

suculent / thinx-device-api / #252646121

07 May 2025 02:21PM UTC coverage: 5.408% (-66.1%) from 71.538%
#252646121

push

suculent
moved some tests aside

28 of 1292 branches covered (2.17%)

Branch coverage included in aggregate %.

171 of 2388 relevant lines covered (7.16%)

0.08 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

6.06
/lib/thinx/plugins.js
1
const fs = require("fs");
1✔
2
class Plugins {
3

4
  constructor() {
5
    this.plugins = {};
×
6
  }
7

8
  async loadFromConfig(path='./plugins/plugins.json') {
×
9
    let contents = fs.readFileSync(path);
×
10
    const plugins = JSON.parse(contents);
×
11
    for (let plugin in plugins) {
×
12
      this.load(plugin);
×
13
    }
14
  }
15

16
  async load(plugin) {
17
    const path = `./plugins/${plugin}/plugin.js`;
×
18
    try {
×
19
      const module = require(path);
×
20
      // for debugging use: console.log("module", module);
21
      this.plugins[plugin] = module;
×
22
      await this.plugins[plugin].load();
×
23
    } catch (e) {
24
      console.log(`[error] [plugins] Failed to load '${plugin}'`);
×
25
    }
26
  }
27

28
  async use(path) {
29
    let results = [];
×
30
    for (let plugin in this.plugins) {
×
31
      let result = this.plugins[plugin].check(path);
×
32
      if (result) {
×
33
        results.push(result);
×
34
      }
35
    }
36
    return results[results.length-1];
×
37
  }
38

39
  extensions() {
40
    let results = new Set();
×
41
    for (let plugin in this.plugins) {
×
42
      let xts = this.plugins[plugin].extensions();
×
43
      if (xts) {
×
44
        for (let xt in xts) {
×
45
          if (!results.has(xt)) results.add(xt);
×
46
        }
47
      }
48
    }
49
    return Array.from(results);
×
50
  }
51
}
52

53
module.exports = Plugins;
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc