Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/rfs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2019-02-13 13:48:15 +0300
committerMartijn Cuppens <martijn.cuppens@gmail.com>2019-02-13 13:48:15 +0300
commite66e165b6e4b104266b6d95b926dff6d4999e90d (patch)
tree2d6f88a5ad04e3b9f804d831117b2831d3be48df /test
parent6bc081ecf0ba95ca6ac1a976741ef2cb7a521fa4 (diff)
ES6-ify and lint all JS files. (#79)
* Enforce LF * ES6-ify and lint all JS files.
Diffstat (limited to 'test')
-rw-r--r--test/lib/result.js30
-rw-r--r--test/lib/tests.js4
-rw-r--r--test/postcss/tests.js6
-rw-r--r--test/test.js2
4 files changed, 26 insertions, 16 deletions
diff --git a/test/lib/result.js b/test/lib/result.js
index 8f59a36..add6340 100644
--- a/test/lib/result.js
+++ b/test/lib/result.js
@@ -1,49 +1,53 @@
+'use strict';
+
// Packages
-const prettier = require("prettier");
-const fs = require("fs");
+const fs = require('fs');
+const prettier = require('prettier');
const sass = require('node-sass');
const less = require('less');
const stylus = require('stylus');
+// Postcss
+const postcss = require('postcss');
+const rfs = require('../..');
+const postcsstests = require('../postcss/tests.js');
+
// Strings
const encoding = 'utf8';
const dir = `${__dirname}/../`;
// Functions
-const format = css => prettier.format(css, {parser: "css"}).replace(/(\n)(\n)/g, '$1');
+const format = css => prettier.format(css, {parser: 'css'}).replace(/(\n)(\n)/g, '$1');
const getFileContent = (folder, id, ext) => fs.readFileSync(`${dir}${folder}/${id}.${ext}`, {encoding});
-// Postcss
-const postcss = require('postcss');
-const rfs = require('../../');
-const postcsstests = require('../postcss/tests.js');
const postcsscss = getFileContent('postcss', 'main', 'css');
// Exports
module.exports = {
// Return formatted expected result
- expected: (id) => format(getFileContent('result', id, 'css')),
+ expected: id => format(getFileContent('result', id, 'css')),
// Return parsed css
- sass: (id) => format(sass.renderSync({file: `${dir}sass/${id}.scss`}).css.toString(encoding)),
+ sass: id => format(sass.renderSync({file: `${dir}sass/${id}.scss`}).css.toString(encoding)),
// Return parsed css
- less: (id) => {
- return less.render(getFileContent('less', id, 'less'), {paths: [dir + 'less'], syncImport: true}).then((result) => {
+ less: id => {
+ return less.render(getFileContent('less', id, 'less'), {paths: [dir + 'less'], syncImport: true}).then(result => {
return format(result.css);
});
},
- stylus: (id) => {
+ stylus: id => {
let formattedCSS = '';
stylus.render(getFileContent('stylus', id, 'styl'), {filename: `${dir}stylus/${id}.styl`}, (err, css) => {
if (err) {
throw err;
}
+
formattedCSS = format(css);
});
return formattedCSS;
},
- postcss: (id) => format(postcss(rfs(postcsstests[id])).process(postcsscss).css)
+ postcss: id => format(postcss(rfs(postcsstests[id])).process(postcsscss).css)
};
diff --git a/test/lib/tests.js b/test/lib/tests.js
index 361b0bf..45dc97d 100644
--- a/test/lib/tests.js
+++ b/test/lib/tests.js
@@ -1,3 +1,5 @@
+'use strict';
+
module.exports = [
{
id: 'test-1',
@@ -38,5 +40,5 @@ module.exports = [
{
id: 'test-10',
name: 'Include mixins multiple times'
- },
+ }
];
diff --git a/test/postcss/tests.js b/test/postcss/tests.js
index 37fb0dd..b5f03d6 100644
--- a/test/postcss/tests.js
+++ b/test/postcss/tests.js
@@ -1,3 +1,5 @@
+'use strict';
+
module.exports = {
'test-1': {},
'test-2': {
@@ -29,7 +31,7 @@ module.exports = {
twoDimensional: true,
factor: 5,
class: true,
- safariIframeResizeBugFix: true,
+ safariIframeResizeBugFix: true
},
'test-10': { // Not testable
baseFontSize: '12px',
@@ -39,6 +41,6 @@ module.exports = {
twoDimensional: true,
factor: 5,
class: true,
- safariIframeResizeBugFix: true,
+ safariIframeResizeBugFix: true
}
};
diff --git a/test/test.js b/test/test.js
index 8340e86..9296599 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1,3 +1,5 @@
+/* eslint-env mocha */
+
'use strict';
const assert = require('assert');