diff options
author | JohnAlbin <virtually.johnalbin@gmail.com> | 2016-03-29 12:43:13 +0300 |
---|---|---|
committer | JohnAlbin <virtually.johnalbin@gmail.com> | 2016-04-23 18:28:55 +0300 |
commit | 7574914387cd6d40839da588c7f2c0367a79c9b4 (patch) | |
tree | 3be60c0b1512997c1490da2f83d6a30c82f5426f /test | |
parent | fe6063bb7aff7de80304ac50e4887cb131ff67d0 (diff) |
Update mocha, chai, and sassy-test.
Diffstat (limited to 'test')
-rw-r--r-- | test/.eslintrc | 4 | ||||
-rw-r--r-- | test/helper.js | 19 | ||||
-rw-r--r-- | test/test_fork-versions.js | 66 | ||||
-rw-r--r-- | test/test_import-now.js | 16 | ||||
-rw-r--r-- | test/test_normalize.js | 47 | ||||
-rw-r--r-- | test/test_variables.js | 110 |
6 files changed, 78 insertions, 184 deletions
diff --git a/test/.eslintrc b/test/.eslintrc index d9f97a2..0bed69d 100644 --- a/test/.eslintrc +++ b/test/.eslintrc @@ -7,9 +7,9 @@ "node": true }, "globals": { + "expect": true, "path": true, - "sassyTest": true, - "should": true + "SassyTest": true }, "rules": { // Errors. diff --git a/test/helper.js b/test/helper.js index f0ec861..4cef65d 100644 --- a/test/helper.js +++ b/test/helper.js @@ -1,21 +1,6 @@ 'use strict'; // Globals for all test_*.js files. +global.expect = require('chai').expect; global.path = require('path'); -global.should = require('chai').should(); -global.sassyTest = require('sassy-test'); - -// This beforeEach() is run before each test in all test_*.js files. -beforeEach(function(done) { - sassyTest.configurePaths({ - includePaths: [ - // Path to Sass library. - path.join(__dirname, '../sass') - // Path to normalize-scss' dependencies. - // @TODO Follow-up #43. Figure out "best" way for node-sass to figure out - // normalize-scss' dependencies' includePaths. - // path.dirname(require.resolve('support-for')) - ] - }); - done(); -}); +global.SassyTest = require('sassy-test'); diff --git a/test/test_fork-versions.js b/test/test_fork-versions.js index b7fb25b..ada71f8 100644 --- a/test/test_fork-versions.js +++ b/test/test_fork-versions.js @@ -2,93 +2,65 @@ describe('Fork versions', function() { describe('Default fork', function() { - beforeEach(function(done) { - sassyTest.configurePaths({ + it('should render properly', function() { + var sassyTest = new SassyTest({ fixtures: path.join(__dirname, 'fixtures/fork-versions'), includePaths: [ // Path to Fork version. path.join(__dirname, '../fork-versions/default'), // Path to normalize-scss' dependencies. - path.join(__dirname, '../node_modules/support-for/sass') + path.dirname(require.resolve('support-for')) ] }); - done(); - }); - - it('should render properly', function(done) { - sassyTest.renderFixture('default', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + return sassyTest.renderFixture('default'); }); }); describe('Ruby Sass with Compass fork', function() { - beforeEach(function(done) { - sassyTest.configurePaths({ + it('should render properly', function() { + var sassyTest = new SassyTest({ fixtures: path.join(__dirname, 'fixtures'), includePaths: [ // Path to Fork version. path.join(__dirname, '../fork-versions/ruby-sass-compass'), // Path to normalize-scss' dependencies. - path.join(__dirname, '../node_modules/support-for/sass') + path.dirname(require.resolve('support-for')) ] }); - done(); - }); - - it('should render properly', function(done) { - sassyTest.renderFixture('fork-versions/ruby-sass-compass', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + return sassyTest.renderFixture('fork-versions/ruby-sass-compass'); }); }); describe('Typey fork', function() { - beforeEach(function(done) { - sassyTest.configurePaths({ + it('should render properly', function() { + var sassyTest = new SassyTest({ fixtures: path.join(__dirname, 'fixtures'), includePaths: [ // Path to Fork version. path.join(__dirname, '../fork-versions/typey'), // Path to normalize-scss' dependencies. - path.join(__dirname, '../node_modules/support-for/sass'), - path.join(__dirname, '../node_modules/typey/stylesheets') + path.dirname(require.resolve('support-for')), + path.dirname(require.resolve('typey')) ] }); - done(); - }); - - it('should render properly', function(done) { - sassyTest.renderFixture('fork-versions/typey', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + return sassyTest.renderFixture('fork-versions/typey'); }); }); describe('Typey, Chroma and KSS fork', function() { - beforeEach(function(done) { - sassyTest.configurePaths({ + it('should render properly', function() { + var sassyTest = new SassyTest({ fixtures: path.join(__dirname, 'fixtures'), includePaths: [ // Path to Fork version. path.join(__dirname, '../fork-versions/typey-chroma-kss'), // Path to normalize-scss' dependencies. - path.join(__dirname, '../node_modules/chroma-sass/sass'), - path.join(__dirname, '../node_modules/support-for/sass'), - path.join(__dirname, '../node_modules/typey/stylesheets') + path.dirname(require.resolve('chroma-sass')), + path.dirname(require.resolve('support-for')), + path.dirname(require.resolve('typey')) ] }); - done(); - }); - - it('should render properly', function(done) { - sassyTest.renderFixture('fork-versions/typey-chroma-kss', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + return sassyTest.renderFixture('fork-versions/typey-chroma-kss'); }); }); }); diff --git a/test/test_import-now.js b/test/test_import-now.js index fbe2142..8433acb 100644 --- a/test/test_import-now.js +++ b/test/test_import-now.js @@ -1,17 +1,11 @@ 'use strict'; describe('@import "normalize/import-now";', function() { - before(function(done) { - sassyTest.configurePaths({ - fixtures: path.join(__dirname, 'fixtures') - }); - done(); - }); - - it('should import the CSS immediately on @import', function(done) { - sassyTest.renderFixture('import-now', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); + it('should import the CSS immediately on @import', function() { + var sassyTest = new SassyTest({ + fixtures: path.join(__dirname, 'fixtures'), + includePaths: [path.join(__dirname, '../sass')] }); + return sassyTest.renderFixture('import-now'); }); }); diff --git a/test/test_normalize.js b/test/test_normalize.js index 926f1b3..bd581e9 100644 --- a/test/test_normalize.js +++ b/test/test_normalize.js @@ -1,56 +1,41 @@ 'use strict'; +var sassyTest = new SassyTest(); + describe('@include normalize()', function() { before(function(done) { sassyTest.configurePaths({ - fixtures: path.join(__dirname, 'fixtures/normalize') + fixtures: path.join(__dirname, 'fixtures/normalize'), + includePaths: [path.join(__dirname, '../sass')] }); done(); }); describe('$include parameter', function() { - it('should accept a list with multiple values', function(done) { - sassyTest.renderFixture('include-multiple', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should accept a list with multiple values', function() { + return sassyTest.renderFixture('include-multiple'); }); - it('should accept a list with a single value', function(done) { - sassyTest.renderFixture('include-single', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should accept a list with a single value', function() { + return sassyTest.renderFixture('include-single'); }); - it('should accept a string', function(done) { - sassyTest.renderFixture('include-string', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should accept a string', function() { + return sassyTest.renderFixture('include-string'); }); }); describe('$exclude parameter', function() { - it('should accept a list with multiple values', function(done) { - sassyTest.renderFixture('exclude-multiple', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should accept a list with multiple values', function() { + return sassyTest.renderFixture('exclude-multiple'); }); - it('should accept a list with a single value', function(done) { - sassyTest.renderFixture('exclude-single', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should accept a list with a single value', function() { + return sassyTest.renderFixture('exclude-single'); }); - it('should accept a string', function(done) { - sassyTest.renderFixture('exclude-string', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should accept a string', function() { + return sassyTest.renderFixture('exclude-string'); }); }); }); diff --git a/test/test_variables.js b/test/test_variables.js index 4dd6982..f54df44 100644 --- a/test/test_variables.js +++ b/test/test_variables.js @@ -1,123 +1,81 @@ 'use strict'; +var sassyTest = new SassyTest(); + describe('Configuration variables', function() { before(function(done) { sassyTest.configurePaths({ - fixtures: path.join(__dirname, 'fixtures') + fixtures: path.join(__dirname, 'fixtures'), + includePaths: [path.join(__dirname, '../sass')] }); done(); }); describe('default values', function() { - it('should limit output to the same output as normalize.css', function(done) { - sassyTest.renderFixture('variables/default', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should limit output to the same output as normalize.css', function() { + return sassyTest.renderFixture('variables/default'); }); }); describe('$base-* and $h*-font-size', function() { - it('should alter the font, font size, and line-height', function(done) { - sassyTest.renderFixture('variables/font', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should alter the font, font size, and line-height', function() { + return sassyTest.renderFixture('variables/font'); }); }); describe('$indent-amount', function() { - it('should alter the indent amount of elements', function(done) { - sassyTest.renderFixture('variables/indent-amount', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should alter the indent amount of elements', function() { + return sassyTest.renderFixture('variables/indent-amount'); }); }); describe('$support-for', function() { - it('should support Chrome 9', function(done) { - sassyTest.renderFixture('variables/support-for/chrome9', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should support Chrome 9', function() { + return sassyTest.renderFixture('variables/support-for/chrome9'); }); - it('should support Firefox 28', function(done) { - sassyTest.renderFixture('variables/support-for/firefox28', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should support Firefox 28', function() { + return sassyTest.renderFixture('variables/support-for/firefox28'); }); - it('should support IE 6', function(done) { - sassyTest.renderFixture('variables/support-for/ie6', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should support IE 6', function() { + return sassyTest.renderFixture('variables/support-for/ie6'); }); - it('should support IE 7', function(done) { - sassyTest.renderFixture('variables/support-for/ie7', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should support IE 7', function() { + return sassyTest.renderFixture('variables/support-for/ie7'); }); - it('should support IE 8', function(done) { - sassyTest.renderFixture('variables/support-for/ie8', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should support IE 8', function() { + return sassyTest.renderFixture('variables/support-for/ie8'); }); - it('should support IE 9', function(done) { - sassyTest.renderFixture('variables/support-for/ie9', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should support IE 9', function() { + return sassyTest.renderFixture('variables/support-for/ie9'); }); - it('should support IE 10', function(done) { - sassyTest.renderFixture('variables/support-for/ie10', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should support IE 10', function() { + return sassyTest.renderFixture('variables/support-for/ie10'); }); - it('should support IE 11', function(done) { - sassyTest.renderFixture('variables/support-for/ie11', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should support IE 11', function() { + return sassyTest.renderFixture('variables/support-for/ie11'); }); - it('should support Safari 5', function(done) { - sassyTest.renderFixture('variables/support-for/safari5', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should support Safari 5', function() { + return sassyTest.renderFixture('variables/support-for/safari5'); }); - it('should support Safari 6', function(done) { - sassyTest.renderFixture('variables/support-for/safari6', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should support Safari 6', function() { + return sassyTest.renderFixture('variables/support-for/safari6'); }); - it('should support Safari 7', function(done) { - sassyTest.renderFixture('variables/support-for/safari7', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should support Safari 7', function() { + return sassyTest.renderFixture('variables/support-for/safari7'); }); - it('should support "last X versions" with -X value', function(done) { - sassyTest.renderFixture('variables/support-for/negative-value', {}, function(error, result, expectedOutput) { - should.not.exist(error); - done(); - }); + it('should support "last X versions" with -X value', function() { + return sassyTest.renderFixture('variables/support-for/negative-value'); }); }); }); |