Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
b
Browse files Browse the repository at this point in the history
xzyfer committed Apr 30, 2016
1 parent 94b55fd commit 9293c4f
Showing 1 changed file with 94 additions and 94 deletions.
188 changes: 94 additions & 94 deletions test/cli.js
Original file line number Diff line number Diff line change
@@ -654,83 +654,83 @@ describe('cli', function() {
});
});

describe('importer', function() {
describe.only('importer', function() {
var dest = fixture('include-files/index.css');
var src = fixture('include-files/index.scss');
var expected = read(fixture('include-files/expected-importer.css'), 'utf8').trim().replace(/\r\n/g, '\n');

it('should override imports and fire callback with file and contents', function(done) {
var bin = spawn(cli, [
src, '--output', path.dirname(dest),
'--importer', fixture('extras/my_custom_importer_file_and_data_cb.js')
]);

bin.once('close', function() {
assert.equal(read(dest, 'utf8').trim(), expected);
fs.unlinkSync(dest);
done();
});
});

it('should override imports and fire callback with file', function(done) {
var bin = spawn(cli, [
src, '--output', path.dirname(dest),
'--importer', fixture('extras/my_custom_importer_file_cb.js')
]);

bin.once('close', function() {
if (fs.existsSync(dest)) {
assert.equal(read(dest, 'utf8').trim(), '');
fs.unlinkSync(dest);
}

done();
});
});

it('should override imports and fire callback with data', function(done) {
var bin = spawn(cli, [
src, '--output', path.dirname(dest),
'--importer', fixture('extras/my_custom_importer_data_cb.js')
]);

bin.once('close', function() {
assert.equal(read(dest, 'utf8').trim(), expected);
fs.unlinkSync(dest);
done();
});
});

it('should override imports and return file and contents', function(done) {
var bin = spawn(cli, [
src, '--output', path.dirname(dest),
'--importer', fixture('extras/my_custom_importer_file_and_data.js')
]);

bin.once('close', function() {
assert.equal(read(dest, 'utf8').trim(), expected);
fs.unlinkSync(dest);
done();
});
});

it('should override imports and return file', function(done) {
var bin = spawn(cli, [
src, '--output', path.dirname(dest),
'--importer', fixture('extras/my_custom_importer_file.js')
]);

bin.once('close', function() {
if (fs.existsSync(dest)) {
assert.equal(read(dest, 'utf8').trim(), '');
fs.unlinkSync(dest);
}

done();
});
});

it.only('should override imports and return data', function(done) {
// it('should override imports and fire callback with file and contents', function(done) {
// var bin = spawn(cli, [
// src, '--output', path.dirname(dest),
// '--importer', fixture('extras/my_custom_importer_file_and_data_cb.js')
// ]);

// bin.once('close', function() {
// assert.equal(read(dest, 'utf8').trim(), expected);
// fs.unlinkSync(dest);
// done();
// });
// });

// it('should override imports and fire callback with file', function(done) {
// var bin = spawn(cli, [
// src, '--output', path.dirname(dest),
// '--importer', fixture('extras/my_custom_importer_file_cb.js')
// ]);

// bin.once('close', function() {
// if (fs.existsSync(dest)) {
// assert.equal(read(dest, 'utf8').trim(), '');
// fs.unlinkSync(dest);
// }

// done();
// });
// });

// it('should override imports and fire callback with data', function(done) {
// var bin = spawn(cli, [
// src, '--output', path.dirname(dest),
// '--importer', fixture('extras/my_custom_importer_data_cb.js')
// ]);

// bin.once('close', function() {
// assert.equal(read(dest, 'utf8').trim(), expected);
// fs.unlinkSync(dest);
// done();
// });
// });

// it('should override imports and return file and contents', function(done) {
// var bin = spawn(cli, [
// src, '--output', path.dirname(dest),
// '--importer', fixture('extras/my_custom_importer_file_and_data.js')
// ]);

// bin.once('close', function() {
// assert.equal(read(dest, 'utf8').trim(), expected);
// fs.unlinkSync(dest);
// done();
// });
// });

// it('should override imports and return file', function(done) {
// var bin = spawn(cli, [
// src, '--output', path.dirname(dest),
// '--importer', fixture('extras/my_custom_importer_file.js')
// ]);

// bin.once('close', function() {
// if (fs.existsSync(dest)) {
// assert.equal(read(dest, 'utf8').trim(), '');
// fs.unlinkSync(dest);
// }

// done();
// });
// });

it('should override imports and return data', function(done) {
console.log('src', src);
console.log('dest', path.dirname(dest));
console.log('importers', fixture('extras/my_custom_importer_data.js'));
@@ -761,7 +761,7 @@ describe('cli', function() {
});
});

it.only('should accept arrays of importers and return respect the order', function(done) {
it('should accept arrays of importers and return respect the order', function(done) {
console.log('src', src);
console.log('dest', path.dirname(dest));
console.log('importers', fixture('extras/my_custom_arrays_of_importers.js'));
@@ -792,29 +792,29 @@ describe('cli', function() {
});
});

it('should return error for invalid importer file path', function(done) {
var bin = spawn(cli, [
src, '--output', path.dirname(dest),
'--importer', fixture('non/existing/path')
]);
// it('should return error for invalid importer file path', function(done) {
// var bin = spawn(cli, [
// src, '--output', path.dirname(dest),
// '--importer', fixture('non/existing/path')
// ]);

bin.once('close', function(code) {
assert.notStrictEqual(code, 0);
done();
});
});
// bin.once('close', function(code) {
// assert.notStrictEqual(code, 0);
// done();
// });
// });

it('should reflect user-defined Error', function(done) {
var bin = spawn(cli, [
src, '--output', path.dirname(dest),
'--importer', fixture('extras/my_custom_importer_error.js')
]);
// it('should reflect user-defined Error', function(done) {
// var bin = spawn(cli, [
// src, '--output', path.dirname(dest),
// '--importer', fixture('extras/my_custom_importer_error.js')
// ]);

bin.stderr.once('data', function(code) {
assert.equal(JSON.parse(code).message, 'doesn\'t exist!');
done();
});
});
// bin.stderr.once('data', function(code) {
// assert.equal(JSON.parse(code).message, 'doesn\'t exist!');
// done();
// });
// });
});

describe('functions', function() {

0 comments on commit 9293c4f

Please sign in to comment.