-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5df463
commit e042a6f
Showing
15 changed files
with
248 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
'use strict' | ||
|
||
const path = require('path') | ||
|
||
const postcss = require('postcss') | ||
const postcssrc = require('../src/index.js') | ||
|
||
const { fixture, expected } = require('./utils.js') | ||
|
||
test('postcss.config.js - {Object} - Load Config', () => { | ||
const ctx = { | ||
parser: true, | ||
syntax: true | ||
} | ||
|
||
return postcssrc(ctx, 'test/js/object').then((config) => { | ||
expect(config.options.parser).toEqual(require('sugarss')) | ||
expect(config.options.syntax).toEqual(require('sugarss')) | ||
expect(config.options.map).toEqual(false) | ||
expect(config.options.from).toEqual('./test/js/object/fixtures/index.css') | ||
expect(config.options.to).toEqual('./test/js/object/expect/index.css') | ||
|
||
expect(config.plugins.length).toEqual(2) | ||
expect(typeof config.plugins[0]).toBe('function') | ||
expect(typeof config.plugins[1]).toBe('function') | ||
|
||
expect(config.file) | ||
.toEqual(path.resolve('test/js/object', 'postcss.config.js')) | ||
}) | ||
}) | ||
|
||
test('postcss.config.js - {Object} - Process CSS', () => { | ||
const ctx = { | ||
parser: false, | ||
syntax: false | ||
} | ||
|
||
return postcssrc(ctx, 'test/js/object').then((config) => { | ||
return postcss(config.plugins) | ||
.process(fixture('js/object', 'index.css'), config.options) | ||
.then((result) => { | ||
expect(result.css).toEqual(expected('js/object', 'index.css')) | ||
}) | ||
}) | ||
}) | ||
|
||
test('postcss.config.js - {Object} - Process SSS', () => { | ||
const ctx = { | ||
from: './test/js/object/fixtures/index.sss', | ||
parser: true, | ||
syntax: false | ||
} | ||
|
||
return postcssrc(ctx, 'test/js/object').then((config) => { | ||
return postcss(config.plugins) | ||
.process(fixture('js/object', 'index.sss'), config.options) | ||
.then((result) => { | ||
expect(result.css).toEqual(expected('js/object', 'index.sss')) | ||
}) | ||
}) | ||
}) | ||
|
||
test('postcss.config.js - {Array} - Load Config', () => { | ||
const ctx = { | ||
parser: true, | ||
syntax: true | ||
} | ||
|
||
return postcssrc(ctx, 'test/js/array').then((config) => { | ||
expect(config.options.parser).toEqual(require('sugarss')) | ||
expect(config.options.syntax).toEqual(require('sugarss')) | ||
expect(config.options.map).toEqual(false) | ||
expect(config.options.from).toEqual('./test/js/array/fixtures/index.css') | ||
expect(config.options.to).toEqual('./test/js/array/expect/index.css') | ||
|
||
expect(config.plugins.length).toEqual(2) | ||
expect(typeof config.plugins[0]).toBe('function') | ||
expect(typeof config.plugins[1]).toBe('function') | ||
|
||
expect(config.file) | ||
.toEqual(path.resolve('test/js/array', 'postcss.config.js')) | ||
}) | ||
}) | ||
|
||
test('postcss.config.js - {Array} - Process CSS', () => { | ||
const ctx = { | ||
parser: false, | ||
syntax: false | ||
} | ||
|
||
return postcssrc(ctx, 'test/js/array').then((config) => { | ||
return postcss(config.plugins) | ||
.process(fixture('js/array', 'index.css'), config.options) | ||
.then((result) => { | ||
expect(result.css).toEqual(expected('js/array', 'index.css')) | ||
}) | ||
}) | ||
}) | ||
|
||
test('postcss.config.js - {Array} - Process SSS', () => { | ||
const ctx = { | ||
from: './test/js/array/fixtures/index.sss', | ||
parser: true, | ||
syntax: false | ||
} | ||
|
||
return postcssrc(ctx, 'test/js/array').then((config) => { | ||
return postcss(config.plugins) | ||
.process(fixture('js/array', 'index.sss'), config.options) | ||
.then((result) => { | ||
expect(result.css).toEqual(expected('js/array', 'index.sss')) | ||
}) | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
'use strict' | ||
|
||
const path = require('path') | ||
|
||
const postcss = require('postcss') | ||
const postcssrc = require('../src/index.js') | ||
|
||
const { fixture, expected } = require('./utils.js') | ||
|
||
test('package.json - {Object} - Load Config', () => { | ||
return postcssrc({}, 'test/pkg').then((config) => { | ||
expect(config.options.parser).toEqual(require('sugarss')) | ||
expect(config.options.syntax).toEqual(require('sugarss')) | ||
expect(config.options.map).toEqual(false) | ||
expect(config.options.from).toEqual('./test/pkg/fixtures/index.css') | ||
expect(config.options.to).toEqual('./test/pkg/expect/index.css') | ||
|
||
expect(config.plugins.length).toEqual(2) | ||
expect(typeof config.plugins[0]).toBe('function') | ||
expect(typeof config.plugins[1]).toBe('function') | ||
|
||
expect(config.file) | ||
.toEqual(path.resolve('test/pkg', 'package.json')) | ||
}) | ||
}) | ||
|
||
test('package.json - {Object} - Process CSS', () => { | ||
const ctx = { | ||
parser: false, | ||
syntax: false | ||
} | ||
|
||
return postcssrc(ctx, 'test/pkg').then((config) => { | ||
return postcss(config.plugins) | ||
.process(fixture('pkg', 'index.css'), config.options) | ||
.then((result) => { | ||
expect(result.css).toEqual(expected('pkg', 'index.css')) | ||
}) | ||
}) | ||
}) | ||
|
||
test('package.json - {Object} - Process SSS', () => { | ||
const ctx = { | ||
from: './test/pkg/fixtures/index.sss', | ||
syntax: false | ||
} | ||
|
||
return postcssrc(ctx, 'test/pkg').then((config) => { | ||
return postcss(config.plugins) | ||
.process(fixture('pkg', 'index.sss'), config.options) | ||
.then((result) => { | ||
expect(result.css).toEqual(expected('pkg', 'index.sss')) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.