(fileType, token)
| 75 | } |
| 76 | |
| 77 | contains(fileType, token) { |
| 78 | if (!this.dom) { |
| 79 | this._evalHtml({}); |
| 80 | } |
| 81 | |
| 82 | if (fileType === 'js') { |
| 83 | for (let element of this.scripts) { |
| 84 | let src = element.getAttribute('src'); |
| 85 | let content = fs.readFileSync(path.join(this.distPath, src), 'utf8'); |
| 86 | |
| 87 | if (content.includes(token)) { |
| 88 | return true; |
| 89 | } |
| 90 | } |
| 91 | } else if (fileType === 'css') { |
| 92 | for (let element of this.links) { |
| 93 | let src = element.getAttribute('href'); |
| 94 | let content = fs.readFileSync(path.join(this.distPath, src), 'utf8'); |
| 95 | |
| 96 | if (content.includes(token)) { |
| 97 | return true; |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | return false; |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | module.exports = DistChecker; |
no test coverage detected