Skip to content

Commit b7f0581

Browse files
🐛 rename processOpts to processorOpts, closes #36
1 parent 8a3d4e1 commit b7f0581

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ npm install --save-dev babel-plugin-css-modules-transform
7777
"preprocessCss": "npm-module-name",
7878
"processCss": "./path/to/module-exporting-a-function.js",
7979
"processCss": "npm-module-name",
80-
"processOpts": "npm-module-name",
81-
"processOpts": "./path/to/module/exporting-a-plain-object.js",
80+
"processorOpts": "npm-module-name",
81+
"processorOpts": "./path/to/module/exporting-a-plain-object.js",
8282
"mode": "string",
8383
"prepend": [
8484
"npm-module-name",

src/options_resolvers/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ export { default as mode } from './mode';
99
export { default as prepend } from './prepend';
1010
export { default as preprocessCss } from './preprocessCss';
1111
export { default as processCss } from './processCss';
12-
export { default as processOpts } from './processOpts';
12+
export { default as processorOpts } from './processorOpts';
1313
export { default as rootDir } from './rootDir';
1414
export { default as use } from './use';

src/options_resolvers/processOpts.js renamed to src/options_resolvers/processorOpts.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ import { isModulePath, isPlainObject, requireLocalFileOrNodeModule } from '../ut
77
*
88
* @returns {String|Function}
99
*/
10-
export default function processOpts(value/* ,currentConfig */) {
10+
export default function processorOpts(value/* ,currentConfig */) {
1111
if (isModulePath(value)) {
1212
const requiredModule = requireLocalFileOrNodeModule(value);
1313

1414
if (isPlainObject(requiredModule)) {
1515
return requiredModule;
1616
}
1717

18-
throw new Error(`Configuration file for 'processOpts' is not exporting a plain object`);
18+
throw new Error(`Configuration file for 'processorOpts' is not exporting a plain object`);
1919
} else if (isPlainObject(value)) {
2020
return value;
2121
} else {
22-
throw new Error(`Configuration 'processOpts' is not a plain object nor a valid path to module`);
22+
throw new Error(`Configuration 'processorOpts' is not a plain object nor a valid path to module`);
2323
}
2424
}

test/options_resolvers/processOpts.spec.js

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { expect } from 'chai';
2+
3+
import processorOpts from '../../src/options_resolvers/processorOpts';
4+
5+
describe('options_resolvers/processorOpts', () => {
6+
it('should throw if processorOpts is not an object or valid module path exporting object', () => {
7+
expect(
8+
() => processorOpts('test/fixtures/generateScopedName.function.module.js')
9+
).to.throw();
10+
11+
expect(
12+
() => processorOpts(null)
13+
).to.throw();
14+
});
15+
16+
it('should return object', () => {
17+
expect(processorOpts({})).to.be.deep.equal({});
18+
expect(processorOpts('test/fixtures/processCss.module.js')).to.be.deep.equal({});
19+
});
20+
});

0 commit comments

Comments
 (0)