Skip to content

Commit 2b37029

Browse files
fix: allow to pass an {Object} (options.syntax/options.stringifier)
1 parent 30d8d51 commit 2b37029

File tree

6 files changed

+16
-7
lines changed

6 files changed

+16
-7
lines changed

lib/options.json

+8-2
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,17 @@
1919
"parser": {
2020
"type": [ "string", "object" ]
2121
},
22+
"plugins": {
23+
"anyOf": [
24+
{ "type": "array" },
25+
{ "instanceof": "Function" }
26+
]
27+
},
2228
"syntax": {
23-
"type": "string"
29+
"type": [ "string", "object" ]
2430
},
2531
"stringifier": {
26-
"type": "string"
32+
"type": [ "string", "object" ]
2733
},
2834
"sourceMap": {
2935
"type": [ "string", "boolean" ]

test/loader.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const { loader } = require('./helpers/compilation')
55

66
describe('Loader', () => {
77
test('Default', () => {
8-
const _ = /style\.(exec\.js|js)$/
98
const config = {
109
loader: {
1110
options: {
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`Options Stringifier - {Function} 1`] = `"module.exports = \\"a color: black\\\\n\\""`;
4+
35
exports[`Options Stringifier - {String} 1`] = `"module.exports = \\"a color: black\\\\n\\""`;
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`Options Syntax - {Function} 1`] = `"module.exports = \\"a\\\\n color: black\\\\n\\""`;
4+
35
exports[`Options Syntax - {String} 1`] = `"module.exports = \\"a\\\\n color: black\\\\n\\""`;

test/options/stringifier.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ describe('Options', () => {
2020
expect(src).toMatchSnapshot()
2121
})
2222
})
23-
// TODO fix schema
24-
test.skip('Stringifier - {Function}', () => {
23+
24+
test('Stringifier - {Function}', () => {
2525
const config = {
2626
loader: {
2727
options: {

test/options/syntax.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ describe('Options', () => {
2020
expect(src).toMatchSnapshot()
2121
})
2222
})
23-
// TODO fix schema
24-
test.skip('Syntax - {Function}', () => {
23+
24+
test('Syntax - {Function}', () => {
2525
const config = {
2626
loader: {
2727
options: {

0 commit comments

Comments
 (0)