forked from sass/node-sass
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathspec.js
54 lines (47 loc) · 1.47 KB
/
spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
var assert = require('assert'),
fs = require('fs'),
exists = fs.existsSync,
path = require('path'),
read = fs.readFileSync,
sass = require('../lib'),
util = require('./util');
describe('spec', function() {
this.timeout(0);
var suites = util.getSuites();
describe('test/sass-spec directory', function() {
it('should be a cloned into place', function(done) {
fs.exists(path.join(__dirname, 'fixtures', 'spec'), function(exists) {
if (!exists) {
throw new Error([
'test/fixtures/spec directory missing. Please clone it into place by',
'executing `git submodule update --init --recursive test/fixtures/spec`',
'from the project\'s root directory.'
].join(' '));
}
assert(exists);
done();
});
});
});
Object.keys(suites).forEach(function(suite) {
var tests = Object.keys(suites[suite]);
describe(suite, function() {
tests.forEach(function(test) {
var t = suites[suite][test];
if (exists(t.src)) {
it(test, function(done) {
var expected = util.normalize(read(t.expected, 'utf8'));
sass.render({
file: t.src,
includePaths: t.paths
}, function(error, result) {
assert(!error);
assert.equal(util.normalize(result.css.toString()), expected);
done();
});
});
}
});
});
});
});