Skip to content

Commit

Permalink
Fix Windows tests
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Nov 25, 2019
1 parent e47435d commit e63cc2e
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const {expect} = require('chai');
const pkg = require('../package.json');
const filterCss = require('..');

const skipWin = process.platform === 'win32' ? it.skip : it;
const CAT = process.platform === 'win32' ? 'type' : 'cat';

const filterTest = _.partial(filterCss, 'test/fixtures/test.css');

function read(file) {
Expand Down Expand Up @@ -349,12 +350,15 @@ describe('Module', () => {
});

describe('CLI', () => {
// empty stdout on appveyor? runs correct on manual test with Windows 7
skipWin('should return the version', done => {
execFile('node', [path.join(__dirname, '../', pkg.bin.filtercss), '--version'], (error, stdout) => {
expect(stdout.replace(/\r\n|\n/g, '')).to.eql(pkg.version);
done();
});
it('should return the version', done => {
execFile(
'node',
[path.join(__dirname, '../', pkg.bin.filtercss), '--version'],
(error, stdout) => {
expect(stdout.trim()).to.equal(pkg.version);
done();
}
);
});

it('should work well with the target stylesheet file passed as an option', done => {
Expand All @@ -380,9 +384,8 @@ describe('CLI', () => {
});
});

// pipes don't work on windows
skipWin('should work well with the target stylesheet file piped to filtercss', done => {
const cp = exec(`cat test/fixtures/test.css | node ${path.join(__dirname, '../', pkg.bin.filtercss)} --ignore @font-face`);
it('should work well with the target stylesheet file piped to filtercss', done => {
const cp = exec(`${CAT} ${path.normalize('test/fixtures/test.css')} | node ${path.join(__dirname, '../', pkg.bin.filtercss)} --ignore @font-face`);

cp.stdout.on('data', css => {
if (css instanceof Buffer) {
Expand Down

0 comments on commit e63cc2e

Please sign in to comment.