This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathspec.js
57 lines (50 loc) · 1.54 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
55
56
57
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 () {
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,
success: function(result) {
assert.equal(util.normalize(result.css), expected);
done();
},
error: function(err) {
assert(!err);
done();
}
});
});
}
});
});
});
});