Skip to content

Commit

Permalink
Replace pn with util.promisify
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Feb 22, 2021
1 parent 53f4ba0 commit 619606a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -64,7 +64,6 @@
"less": "^3.13.1",
"mocha": "^8.3.0",
"node-sass": "^5.0.0",
"pn": "^1.1.0",
"rimraf": "^3.0.2",
"should": "^13.2.3",
"stylus": "^0.54.8",
Expand Down
9 changes: 6 additions & 3 deletions test/svg-sprite.js
Expand Up @@ -13,7 +13,8 @@
* @license MIT https://raw.github.com/jkphl/svg-sprite/master/LICENSE.txt
*/

var fs = require('pn/fs'); // https://www.npmjs.com/package/pn
var fs = require('fs');
var util = require('util');
var svg2png = require('svg2png');
var should = require('should'),
path = require('path'),
Expand All @@ -37,6 +38,8 @@ var cwdWeather = path.join(__dirname, 'fixture', 'svg', 'single'),
dest = path.normalize(path.join(__dirname, '..', 'tmp'));

var isNodeGreaterThan10 = process.version.split('.')[0].slice(1) > 10;
var readFileP = util.promisify(fs.readFile);
var writeFileP = util.promisify(fs.writeFile);

/**
* Add a bunch of SVG files
Expand Down Expand Up @@ -132,10 +135,10 @@ function compareSvg2Png(svg, png, expected, diff, done, msg) {
should(err).not.ok;
done();
};
fs.readFile(svg)
readFileP(svg)
.then(svg2png)
.then(function (buffer) {
fs.writeFile(png, buffer)
writeFileP(png, buffer)
.then(function () {
imageDiff({
actualImage: png,
Expand Down

0 comments on commit 619606a

Please sign in to comment.