Comparing version 0.3.1 to 0.3.2
import m from '../'; | ||
jest.mock('fs'); | ||
jest.mock('recursive-readdir'); | ||
describe('os-fonts', () => { | ||
const fs = require('fs'); | ||
const recursive = require('recursive-readdir'); | ||
it('should retrieve some fonts', async () => { | ||
// set up mock data | ||
fs.__setFiles([ | ||
recursive.__setFiles([ | ||
'foo.ttf', | ||
@@ -19,3 +19,3 @@ 'bar.ttf', | ||
it('should retrieve no fonts', async () => { | ||
fs.__setFiles([]); | ||
recursive.__setFiles([]); | ||
const fonts = await m.getAll(); | ||
@@ -27,3 +27,3 @@ expect(fonts.length).toBe(0); | ||
// set up mock data | ||
fs.__setFiles([]); | ||
recursive.__setFiles([]); | ||
const fonts = await m.getAll('user'); | ||
@@ -35,3 +35,3 @@ expect(fonts.length).toBe(0); | ||
// set up mock data | ||
fs.__setFiles([ | ||
recursive.__setFiles([ | ||
'foo.ttf', | ||
@@ -47,3 +47,3 @@ 'bar.ttf', | ||
it('should return nothing for readdir errors', async () => { | ||
fs.__setReturnError(true); | ||
recursive.__setReturnError(true); | ||
const fonts = await m.getAll('network'); | ||
@@ -50,0 +50,0 @@ expect(fonts.length).toBe(0); |
@@ -0,3 +1,3 @@ | ||
const recursive = require('recursive-readdir'); | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const os = require('os'); | ||
@@ -39,3 +39,3 @@ | ||
exports.getFontsInDirectory = dir => new Promise((resolve) => { | ||
fs.readdir(dir, (err, files) => { | ||
recursive(dir, (err, files) => { | ||
if (err) { | ||
@@ -45,3 +45,3 @@ resolve([]); | ||
} | ||
resolve(files.map(f => path.join(dir, f))); | ||
resolve(files); | ||
}); | ||
@@ -48,0 +48,0 @@ }); |
{ | ||
"name": "os-fonts", | ||
"version": "0.3.1", | ||
"description": "Retrieve fonts available on your OS.", | ||
"keywords": [ | ||
"fonts", | ||
"font", | ||
"os", | ||
"system" | ||
], | ||
"main": "index.js", | ||
"scripts": { | ||
"lint": "eslint index.js __tests", | ||
"test": "npm run lint && jest --coverage" | ||
}, | ||
"version": "0.3.2", | ||
"author": "Vu Tran <vu@vu-tran.com>", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/vutran/os-fonts.git" | ||
"dependencies": { | ||
"recursive-readdir": "github:niftylettuce/recursive-readdir" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
@@ -28,2 +14,3 @@ "babel-jest": "^16.0.0", | ||
"babel-preset-es2015": "^6.18.0", | ||
"coveralls": "^2.11.14", | ||
"eslint": "^3.9.0", | ||
@@ -34,3 +21,19 @@ "eslint-config-airbnb-base": "^9.0.0", | ||
"jest": "^16.0.2" | ||
}, | ||
"keywords": [ | ||
"font", | ||
"fonts", | ||
"os", | ||
"system" | ||
], | ||
"license": "MIT", | ||
"main": "index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/vutran/os-fonts.git" | ||
}, | ||
"scripts": { | ||
"lint": "eslint index.js __tests", | ||
"test": "jest --coverage" | ||
} | ||
} |
# os-fonts | ||
[![Travis](https://img.shields.io/travis/vutran/os-fonts/develop.svg?maxAge=2592000&style=flat-square)](https://travis-ci.org/vutran/os-fonts) [![Coveralls branch](https://img.shields.io/coveralls/vutran/os-fonts/develop.svg?maxAge=2592000&style=flat-square)](https://coveralls.io/github/vutran/os-fonts) [![license](https://img.shields.io/github/license/vutran/os-fonts.svg?maxAge=2592000&style=flat-square)](LICENSE) | ||
> Retrieve fonts available on your OS. | ||
@@ -4,0 +6,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
114483
55
5
1
10
121
1