/
githubmirror
/
angular.js
Обзор
Документация
Войти
/
githubmirror
/
angular.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/e2e/tools/util.js
44 строки
913 B
Michał Gołębiowski
chore(*): switch from JSHint/JSCS to ESLint
05 авг 2016, 23:18
05 авг 2016, 23:18
c322032
Код
Авторство
О чём код?
'use strict'; var fs = require('fs'); var path = require('path'); var root = path.resolve(__dirname, '..'); var tests = path.resolve(root, 'fixtures'); function stat(path) { try { return fs.statSync(path); } catch (e) { // Ignore ENOENT. if (e.code !== 'ENOENT') { throw e; } } } function testExists(testname) { var s = stat(path.resolve(tests, testname)); return s && s.isDirectory(); } function rewriteTestFile(testname, testfile) { if (testfile.search(/^https?:\/\//) === 0) { return testfile; } var i = 0; while (testfile[i] === '/') ++i; testfile = testfile.slice(i); var s = stat(path.resolve(tests, testname, testfile)); if (s && (s.isFile() || s.isDirectory())) { return ['/test/e2e/fixtures', testname, testfile].join('/'); } return false; } module.exports = { stat: stat, testExists: testExists, rewriteTestFile: rewriteTestFile };