replace jest with ava

This commit is contained in:
Robert Brignull 2020-05-04 18:50:13 +01:00
parent 27cc8b23fe
commit 0347b72305
11775 changed files with 84546 additions and 1440575 deletions

14
node_modules/@concordance/react/LICENSE generated vendored Normal file
View file

@ -0,0 +1,14 @@
ISC License (ISC)
Copyright (c) 2017, Mark Wubben <mark@novemberborn.net> (novemberborn.net)
Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.

18
node_modules/@concordance/react/README.md generated vendored Normal file
View file

@ -0,0 +1,18 @@
# @concordance/react
React plugin for [Concordance](https://github.com/concordancejs/concordance).
Allows
[`React.createElement()`](https://facebook.github.io/react/docs/react-api.html#createelement)
objects to be compared, formatted, diffed and serialized. Also supports
`toJSON()` renderings of
[`react-test-renderer`](https://www.npmjs.com/package/react-test-renderer).
These may be compared to `React.createElement()` objects.
When comparing [React
component](https://facebook.github.io/react/docs/components-and-props.html)
elements, the element type is compared by identity. After deserialization the
element types are compared by function name.
Component elements are formatted with a &#x235F; character after the element
name. Properties and children are formatted by [Concordance](https://github.com/concordancejs/concordance).

75
node_modules/@concordance/react/index.js generated vendored Normal file
View file

@ -0,0 +1,75 @@
'use strict'
const pkg = require('./package.json')
const elementFactory = require('./lib/elementFactory')
const testJsonFactory = require('./lib/testJsonFactory')
// Must be unique across all registered plugins.
exports.name = pkg.name
// Expected API version to be passed to register().
exports.apiVersion = 1
// Expected minimal version of Concordance. Concordance will increment its API
// version for breaking changes, this is useful if you rely on features or
// patches that were introduced in a specific version of Concordance.
exports.minimalConcordanceVersion = '1.0.0'
// Plugin-specific version of its serialization output.
exports.serializerVersion = 2
exports.theme = {
react: {
functionType: '\u235F',
openTag: {
start: '<',
end: '>',
selfClose: '/',
selfCloseVoid: ' /'
},
closeTag: {
open: '</',
close: '>'
},
tagName: {open: '', close: ''},
attribute: {
separator: '=',
value: {
openBracket: '{',
closeBracket: '}',
string: {
line: {open: '"', close: '"', escapeQuote: '"'}
}
}
},
child: {
openBracket: '{',
closeBracket: '}',
string: {
line: {open: '', close: '', escapeQuote: ''},
multiline: {start: '', end: '', escapeQuote: ''}
}
}
}
}
const ELEMENT = Symbol.for('react.element')
const TEST_JSON = Symbol.for('react.test.json')
function register (api) {
const reactTags = new Set()
const element = elementFactory(api, reactTags)
const testJson = testJsonFactory(api, element)
api.addDescriptor(0x01, element.tag, element.deserialize)
api.addDescriptor(0x02, testJson.tag, testJson.deserialize)
reactTags.add(element.tag).add(testJson.tag)
return value => {
if (value.$$typeof === ELEMENT) return element.describe
if (value.$$typeof === TEST_JSON) return testJson.describe
return null
}
}
exports.register = register

239
node_modules/@concordance/react/lib/diffShallow.js generated vendored Normal file
View file

@ -0,0 +1,239 @@
'use strict'
function diffShallow (api, actual, expected, theme, indent) {
const childBuffer = api.lineBuilder.buffer()
const propertyBuffer = api.lineBuilder.buffer()
return {
append (formatted, origin) {
if (origin.isItem === true) {
childBuffer.append(formatted)
} else {
propertyBuffer.append(formatted)
}
},
finalize: () => {
const namesAreEqual = actual.compareNames(expected)
const actualName = actual.formatName(theme)
const expectedName = expected.formatName(theme)
const openTag = theme.react.openTag
const innerIndentation = indent.increase()
const allChildren = childBuffer.withFirstPrefixed(innerIndentation)
const children = allChildren.decompose()
const allProperties = propertyBuffer.withFirstPrefixed(innerIndentation)
const properties = allProperties.decompose()
// If the first properties are also the last, and either side has no
// children, ensure the properties are treated as being last. This
// leads to a better balanced diff.
if (properties.remaining.isEmpty && (!actual.hasChildren || !expected.hasChildren)) {
properties.last = properties.first
properties.first = {actual: api.lineBuilder.buffer(), expected: api.lineBuilder.buffer()}
}
const result = api.lineBuilder.buffer()
// Create a custom diff that is as neat as possible. It's likely
// there's a generic algorithm that can be used, but for expediency's
// sake handles all possible diffs by brute force instead.
if (actual.hasProperties && expected.hasProperties) {
if (namesAreEqual) {
result
.append(api.lineBuilder.first(openTag.start + actualName))
.append(properties.first.actual.stripFlags())
.append(properties.first.expected.stripFlags())
} else {
result
.append(api.lineBuilder.actual.first(openTag.start + actualName))
.append(properties.first.actual.stripFlags())
.append(api.lineBuilder.expected.first(openTag.start + expectedName))
.append(properties.first.expected.stripFlags())
}
result.append(properties.remaining.stripFlags())
if (actual.hasChildren && expected.hasChildren) {
result
.append(properties.last.actual.stripFlags())
.append(properties.last.expected.stripFlags())
.append(api.lineBuilder.line(indent + openTag.end))
if (namesAreEqual) {
result
.append(allChildren.stripFlags())
.append(api.lineBuilder.last(indent + api.wrapFromTheme(theme.react.closeTag, actualName)))
} else {
result
.append(children.first.actual.stripFlags())
.append(children.first.expected.stripFlags())
.append(children.remaining.stripFlags())
.append(children.last.actual.stripFlags())
.append(api.lineBuilder.actual.last(indent + api.wrapFromTheme(theme.react.closeTag, actualName)))
.append(children.last.expected.stripFlags())
.append(api.lineBuilder.expected.last(indent + api.wrapFromTheme(theme.react.closeTag, expectedName)))
}
} else if (actual.hasChildren) {
result
.append(properties.last.actual.stripFlags())
.append(api.lineBuilder.actual.line(indent + openTag.end))
.append(allChildren.stripFlags())
.append(api.lineBuilder.actual.last(indent + api.wrapFromTheme(theme.react.closeTag, actualName)))
.append(properties.last.expected.stripFlags())
.append(api.lineBuilder.expected.last(indent + openTag.selfClose + openTag.end))
} else if (expected.hasChildren) {
result
.append(properties.last.actual.stripFlags())
.append(api.lineBuilder.actual.last(indent + openTag.selfClose + openTag.end))
.append(properties.last.expected.stripFlags())
.append(api.lineBuilder.expected.line(indent + openTag.end))
.append(allChildren.stripFlags())
.append(api.lineBuilder.expected.last(indent + api.wrapFromTheme(theme.react.closeTag, expectedName)))
} else {
result
.append(properties.last.actual.stripFlags())
.append(properties.last.expected.stripFlags())
.append(api.lineBuilder.last(indent + openTag.selfClose + openTag.end))
}
} else if (actual.hasProperties) {
result
.append(api.lineBuilder.actual.first(openTag.start + actualName))
.append(allProperties.stripFlags())
if (actual.hasChildren && expected.hasChildren) {
result
.append(api.lineBuilder.actual.line(indent + openTag.end))
.append(children.first.actual.stripFlags())
.append(api.lineBuilder.expected.first(openTag.start + expectedName + openTag.end))
.append(children.first.expected.stripFlags())
.append(children.remaining.stripFlags())
if (namesAreEqual) {
result
.append(children.last.actual.stripFlags())
.append(children.last.expected.stripFlags())
.append(api.lineBuilder.last(indent + api.wrapFromTheme(theme.react.closeTag, actualName)))
} else {
result
.append(children.last.actual.stripFlags())
.append(api.lineBuilder.actual.last(indent + api.wrapFromTheme(theme.react.closeTag, actualName)))
.append(children.last.expected.stripFlags())
.append(api.lineBuilder.expected.last(indent + api.wrapFromTheme(theme.react.closeTag, expectedName)))
}
} else if (actual.hasChildren) {
result
.append(api.lineBuilder.actual.last(indent + openTag.selfClose + openTag.end))
.append(allChildren.stripFlags())
.append(api.lineBuilder.actual.last(indent + api.wrapFromTheme(theme.react.closeTag, actualName)))
.append(api.lineBuilder.expected.single(openTag.start + expectedName + openTag.selfCloseVoid + openTag.end))
} else if (expected.hasChildren) {
result
.append(api.lineBuilder.actual.last(indent + openTag.selfClose + openTag.end))
.append(api.lineBuilder.expected.first(openTag.start + expectedName + openTag.end))
.append(allChildren.stripFlags())
.append(api.lineBuilder.expected.last(indent + api.wrapFromTheme(theme.react.closeTag, expectedName)))
} else {
result
.append(api.lineBuilder.actual.last(indent + openTag.selfClose + openTag.end))
.append(api.lineBuilder.expected.single(openTag.start + expectedName + openTag.selfCloseVoid + openTag.end))
}
} else if (expected.hasProperties) {
if (actual.hasChildren && expected.hasChildren) {
result
.append(api.lineBuilder.actual.first(openTag.start + actualName + openTag.end))
.append(children.first.actual.stripFlags())
.append(api.lineBuilder.expected.first(openTag.start + expectedName))
.append(allProperties.stripFlags())
.append(api.lineBuilder.expected.line(indent + openTag.end))
.append(children.first.expected.stripFlags())
.append(children.remaining.stripFlags())
if (namesAreEqual) {
result
.append(children.last.actual.stripFlags())
.append(children.last.expected.stripFlags())
.append(api.lineBuilder.last(indent + api.wrapFromTheme(theme.react.closeTag, actualName)))
} else {
result
.append(children.last.actual.stripFlags())
.append(api.lineBuilder.actual.last(indent + api.wrapFromTheme(theme.react.closeTag, actualName)))
.append(children.last.expected.stripFlags())
.append(api.lineBuilder.expected.last(indent + api.wrapFromTheme(theme.react.closeTag, expectedName)))
}
} else if (actual.hasChildren) {
result
.append(api.lineBuilder.actual.first(openTag.start + actualName + openTag.end))
.append(allChildren.stripFlags())
.append(api.lineBuilder.actual.last(indent + api.wrapFromTheme(theme.react.closeTag, actualName)))
.append(api.lineBuilder.expected.first(openTag.start + expectedName))
.append(allProperties.stripFlags())
.append(api.lineBuilder.expected.last(indent + openTag.selfClose + openTag.end))
} else if (expected.hasChildren) {
result
.append(api.lineBuilder.actual.single(openTag.start + actualName + openTag.selfCloseVoid + openTag.end))
.append(api.lineBuilder.expected.first(openTag.start + expectedName))
.append(allProperties.stripFlags())
.append(api.lineBuilder.expected.line(indent + openTag.end))
.append(allChildren.stripFlags())
.append(api.lineBuilder.expected.last(indent + api.wrapFromTheme(theme.react.closeTag, expectedName)))
} else {
result
.append(api.lineBuilder.actual.single(openTag.start + actualName + openTag.selfCloseVoid + openTag.end))
.append(api.lineBuilder.expected.first(openTag.start + expectedName))
.append(allProperties.stripFlags())
.append(api.lineBuilder.expected.last(indent + openTag.selfCloseVoid + openTag.end))
}
} else {
if (actual.hasChildren && expected.hasChildren) {
if (namesAreEqual) {
result
.append(api.lineBuilder.first(openTag.start + actualName + openTag.end))
.append(allChildren.stripFlags())
.append(api.lineBuilder.last(indent + api.wrapFromTheme(theme.react.closeTag, actualName)))
} else {
result
.append(api.lineBuilder.actual.first(openTag.start + actualName + openTag.end))
.append(children.first.actual.stripFlags())
.append(api.lineBuilder.expected.first(openTag.start + expectedName + openTag.end))
.append(children.first.expected.stripFlags())
.append(children.remaining.stripFlags())
.append(children.last.actual.stripFlags())
.append(api.lineBuilder.actual.last(indent + api.wrapFromTheme(theme.react.closeTag, actualName)))
.append(children.last.expected.stripFlags())
.append(api.lineBuilder.expected.last(indent + api.wrapFromTheme(theme.react.closeTag, expectedName)))
}
} else if (actual.hasChildren) {
result
.append(api.lineBuilder.actual.first(openTag.start + actualName + openTag.end))
.append(allChildren.stripFlags())
.append(api.lineBuilder.actual.last(indent + api.wrapFromTheme(theme.react.closeTag, actualName)))
.append(api.lineBuilder.expected.single(openTag.start + expectedName + openTag.selfCloseVoid + openTag.end))
} else if (expected.hasChildren) {
result
.append(api.lineBuilder.actual.single(openTag.start + actualName + openTag.selfCloseVoid + openTag.end))
.append(api.lineBuilder.expected.first(openTag.start + expectedName + openTag.end))
.append(allChildren.stripFlags())
.append(api.lineBuilder.expected.last(indent + api.wrapFromTheme(theme.react.closeTag, actualName)))
} else {
if (namesAreEqual) {
result.append(api.lineBuilder.single(openTag.start + actualName + openTag.selfCloseVoid + openTag.end))
} else {
result
.append(api.lineBuilder.actual.single(openTag.start + actualName + openTag.selfCloseVoid + openTag.end))
.append(api.lineBuilder.expected.single(openTag.start + expectedName + openTag.selfCloseVoid + openTag.end))
}
}
}
return result
},
shouldFormat (subject) {
return subject.isItem === true || subject.isProperty === true
},
increaseIndent: true
}
}
module.exports = diffShallow

353
node_modules/@concordance/react/lib/elementFactory.js generated vendored Normal file
View file

@ -0,0 +1,353 @@
'use strict'
const arrify = require('arrify')
const diffShallow = require('./diffShallow')
const escapeText = require('./escapeText')
const FRAGMENT_NAME = Symbol.for('react.fragment')
function factory (api, reactTags) {
const tag = Symbol('@concordance/react.ElementValue')
function customPropertyFormatter (theme, indent, key, value) {
const separator = theme.react.attribute.separator + theme.react.attribute.value.openBracket
if (value.isSingle) {
return value
.withFirstPrefixed(key.formatAsKey(theme) + separator)
.withLastPostfixed(theme.react.attribute.value.closeBracket)
}
return api.lineBuilder.first(key.formatAsKey(theme) + separator)
.concat(value.withFirstPrefixed(indent.increase()).stripFlags())
.append(api.lineBuilder.last(indent + theme.react.attribute.value.closeBracket))
}
function themeProperty (theme) {
theme.property.increaseValueIndent = true
theme.property.customFormat = customPropertyFormatter
}
function themeStringProperty (theme) {
theme.property.separator = theme.react.attribute.separator
theme.property.after = ''
Object.assign(theme.string.line, theme.react.attribute.value.string.line)
}
function customItemFormatter (theme, indent, value) {
if (value.isSingle) {
return value
.withFirstPrefixed(theme.react.child.openBracket)
.withLastPostfixed(theme.react.child.closeBracket)
}
return api.lineBuilder.first(theme.react.child.openBracket)
.concat(value.withFirstPrefixed(indent.increase()).stripFlags())
.append(api.lineBuilder.last(indent + theme.react.child.closeBracket))
}
function themeChild (theme) {
theme.item.increaseValueIndent = true
theme.item.customFormat = customItemFormatter
}
function themeReactChild (theme) {
theme.item.after = ''
}
function themeStringChild (theme) {
theme.item.after = ''
Object.assign(theme.string, theme.react.child.string)
}
function describe (props) {
const element = props.value
const type = element.type
const hasTypeFn = typeof type === 'function'
const typeFn = hasTypeFn ? type : null
const name = hasTypeFn ? type.displayName || type.name : type
const children = arrify(element.props.children)
const properties = Object.assign({}, element.props)
delete properties.children
if (element.key !== null) {
properties.key = element.key
}
const hasProperties = Object.keys(properties).length > 0
return new DescribedElementValue(Object.assign({
children,
hasProperties,
hasTypeFn,
name,
properties,
typeFn,
isList: children.length > 0
}, props))
}
function deserialize (state, recursor) {
return new DeserializedElementValue(state, recursor)
}
class ElementValue extends api.ObjectValue {
constructor (props) {
super(props)
this.isFragment = props.name === FRAGMENT_NAME
this.name = props.name
this.hasProperties = props.hasProperties
this.hasTypeFn = props.hasTypeFn
this.hasChildren = this.isList
}
compare (expected) {
return this.tag === expected.tag && this.name === expected.name
? api.SHALLOW_EQUAL
: api.UNEQUAL
}
formatName (theme) {
const formatted = api.wrapFromTheme(theme.react.tagName, this.isFragment ? 'React.Fragment' : this.name)
return this.hasTypeFn
? formatted + theme.react.functionType
: formatted
}
compareNames (expected) {
return this.name === expected.name && this.hasTypeFn === expected.hasTypeFn
}
formatShallow (theme, indent) {
const childBuffer = api.lineBuilder.buffer()
const propertyBuffer = api.lineBuilder.buffer()
return {
append (formatted, origin) {
if (origin.isItem === true) {
childBuffer.append(formatted)
} else {
propertyBuffer.append(formatted)
}
},
finalize: () => {
const name = this.formatName(theme)
const openTag = theme.react.openTag
if (!this.hasChildren && !this.hasProperties) {
return api.lineBuilder.single(openTag.start + name + openTag.selfCloseVoid + openTag.end)
}
const innerIndentation = indent.increase()
const children = childBuffer.withFirstPrefixed(innerIndentation).stripFlags()
const properties = propertyBuffer.withFirstPrefixed(innerIndentation).stripFlags()
const result = api.lineBuilder.buffer()
if (this.hasProperties) {
result
.append(api.lineBuilder.first(openTag.start + name))
.append(properties)
if (this.hasChildren) {
result.append(api.lineBuilder.line(indent + openTag.end))
} else {
result.append(api.lineBuilder.last(indent + openTag.selfClose + openTag.end))
}
} else {
result.append(api.lineBuilder.first(openTag.start + name + openTag.end))
}
if (this.hasChildren) {
result
.append(children)
.append(api.lineBuilder.last(indent + api.wrapFromTheme(theme.react.closeTag, name)))
}
return result
},
maxDepth: () => {
const name = this.formatName(theme)
const openTag = theme.react.openTag
if (!this.hasChildren && !this.hasProperties) {
return api.lineBuilder.single(openTag.start + name + openTag.selfCloseVoid + openTag.end)
}
let str = openTag.start + name
if (this.hasProperties) {
str += theme.maxDepth
if (this.hasChildren) {
str += openTag.end
} else {
str += ' ' + openTag.selfClose + openTag.end
}
} else {
str += openTag.end
}
if (this.hasChildren) {
str += theme.maxDepth + api.wrapFromTheme(theme.react.closeTag, name)
}
return api.lineBuilder.single(str)
},
shouldFormat (subject) {
return subject.isItem === true || subject.isProperty === true
},
increaseIndent: true
}
}
prepareDiff (expected) {
return {
compareResult: this.tag === expected.tag
? api.SHALLOW_EQUAL
: api.UNEQUAL
}
}
diffShallow (expected, theme, indent) {
return diffShallow(api, this, expected, theme, indent)
}
serialize () {
return [this.isFragment, this.isFragment ? null : this.name, this.hasProperties, this.hasTypeFn, super.serialize()]
}
}
Object.defineProperty(ElementValue.prototype, 'tag', {value: tag})
function modifyThemes (recursor) {
return api.mapRecursor(recursor, next => {
let modifier
if (next.isItem === true) {
if (next.tag === api.descriptorTags.primitiveItem && next.value.tag === api.descriptorTags.string) {
modifier = themeStringChild
} else if (next.tag === api.descriptorTags.complexItem && reactTags.has(next.value.tag)) {
modifier = themeReactChild
} else {
modifier = themeChild
}
} else if (next.isProperty === true) {
if (
next.tag === api.descriptorTags.primitiveProperty &&
next.value.tag === api.descriptorTags.string &&
!next.value.includesLinebreaks
) {
modifier = themeStringProperty
} else {
modifier = themeProperty
}
}
return modifier
? api.modifyTheme(next, modifier)
: next
})
}
function DescribedMixin (base) {
return class extends api.DescribedMixin(base) {
constructor (props) {
super(props)
this.children = props.children
this.properties = props.properties
this.typeFn = props.typeFn
}
compare (expected) {
const result = super.compare(expected)
return result === api.SHALLOW_EQUAL && this.typeFn !== expected.typeFn
? api.UNEQUAL
: result
}
compareNames (expected) {
return super.compareNames(expected) && this.typeFn === expected.typeFn
}
createPropertyRecursor () {
// Symbols are not valid property keys for React elements. This code
// also assumes that the keys can be formatted as JSX-like attribute
// names. Keys are not pre-escaped before being passed to Concordance's
// property descriptor.
const keys = Object.keys(this.properties).sort()
const size = keys.length
let index = 0
const next = () => {
if (index === size) return null
const key = keys[index++]
// Note that string values are not specifically escaped such that the
// output is valid JSX.
return this.describeProperty(key, this.describeAny(this.properties[key]))
}
return {size, next}
}
createListRecursor () {
if (!this.isList) return super.createListRecursor()
const size = this.children.length
let index = 0
const next = () => {
if (index === size) return null
const current = index++
const child = this.children[current]
const type = typeof child
let descriptor
if (type === 'string') {
descriptor = this.describeAny(escapeText(child))
} else {
descriptor = this.describeAny(child)
}
return this.describeItem(current, descriptor)
}
return {size, next}
}
createRecursor () {
return modifyThemes(super.createRecursor())
}
}
}
function DeserializedMixin (base) {
return class extends api.DeserializedMixin(base) {
constructor (state, recursor) {
super(state[4], recursor)
this.isFragment = state[0]
this.name = this.isFragment ? FRAGMENT_NAME : state[1]
this.hasProperties = state[2]
this.hasTypeFn = state[3]
}
createRecursor () {
return modifyThemes(super.createRecursor())
}
}
}
const DescribedElementValue = DescribedMixin(ElementValue)
const DeserializedElementValue = DeserializedMixin(ElementValue)
return {
DescribedMixin,
DeserializedMixin,
ElementValue,
describe,
deserialize,
tag
}
}
module.exports = factory

10
node_modules/@concordance/react/lib/escapeText.js generated vendored Normal file
View file

@ -0,0 +1,10 @@
'use strict'
function escapeText (text) {
return text
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
// TODO: Escape characters that Concordance would otherwise replace with \u
// sequences.
}
module.exports = escapeText

59
node_modules/@concordance/react/lib/testJsonFactory.js generated vendored Normal file
View file

@ -0,0 +1,59 @@
'use strict'
const arrify = require('arrify')
function factory (api, element) {
const tag = Symbol('@concordance/react.TestJsonValue')
function describe (props) {
const obj = props.value
const name = obj.type
const children = arrify(obj.children)
const properties = Object.assign({}, obj.props)
const hasProperties = Object.keys(properties).length > 0
return new DescribedTestJsonValue(Object.assign({
children,
hasProperties,
hasTypeFn: false,
name,
properties,
typeFn: null,
isList: children.length > 0
}, props))
}
function deserialize (state, recursor) {
return new DeserializedTestJsonValue(state, recursor)
}
class TestJsonValue extends element.ElementValue {
compare (expected) {
// Allow expected value to be a React element.
return (this.tag === expected.tag || expected.tag === element.tag) && this.name === expected.name
? api.SHALLOW_EQUAL
: api.UNEQUAL
}
prepareDiff (expected) {
return {
// Allow expected value to be a React element.
compareResult: this.tag === expected.tag || expected.tag === element.tag
? api.SHALLOW_EQUAL
: api.UNEQUAL
}
}
}
Object.defineProperty(TestJsonValue.prototype, 'tag', {value: tag})
const DescribedTestJsonValue = element.DescribedMixin(TestJsonValue)
const DeserializedTestJsonValue = element.DeserializedMixin(TestJsonValue)
return {
describe,
deserialize,
tag
}
}
module.exports = factory

View file

@ -0,0 +1,8 @@
'use strict';
module.exports = function (val) {
if (val === null || val === undefined) {
return [];
}
return Array.isArray(val) ? val : [val];
};

View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -0,0 +1,33 @@
{
"name": "arrify",
"version": "1.0.1",
"description": "Convert a value to an array",
"license": "MIT",
"repository": "sindresorhus/arrify",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"array",
"arr",
"arrify",
"arrayify",
"convert",
"value"
],
"devDependencies": {
"ava": "*",
"xo": "*"
}
}

View file

@ -0,0 +1,36 @@
# arrify [![Build Status](https://travis-ci.org/sindresorhus/arrify.svg?branch=master)](https://travis-ci.org/sindresorhus/arrify)
> Convert a value to an array
## Install
```
$ npm install --save arrify
```
## Usage
```js
const arrify = require('arrify');
arrify('unicorn');
//=> ['unicorn']
arrify(['unicorn']);
//=> ['unicorn']
arrify(null);
//=> []
arrify(undefined);
//=> []
```
*Supplying `null` or `undefined` results in an empty array.*
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

75
node_modules/@concordance/react/package.json generated vendored Normal file
View file

@ -0,0 +1,75 @@
{
"name": "@concordance/react",
"version": "2.0.0",
"description": "Compare, format, diff and serialize React trees with Concordance",
"main": "index.js",
"files": [
"lib",
"index.js"
],
"engines": {
"node": ">=6.12.3 <7 || >=8.9.4 <9 || >=10.0.0"
},
"scripts": {
"build:fixtures": "babel --presets=module:@babel/preset-react,module:ava/stage-4 --out-dir=test/fixtures/react --extensions=.jsx test/fixtures/react",
"lint": "as-i-preach",
"pretest": "npm run -s build:fixtures",
"test": "npm run -s lint && nyc ava"
},
"repository": {
"type": "git",
"url": "git+https://github.com/concordancejs/react.git"
},
"author": "Mark Wubben (https://novemberborn.net/)",
"license": "ISC",
"bugs": {
"url": "https://github.com/concordancejs/react/issues"
},
"homepage": "https://github.com/concordancejs/react#readme",
"keywords": [
"concordance-plugin",
"concordance",
"react"
],
"dependencies": {
"arrify": "^1.0.1"
},
"devDependencies": {
"@babel/cli": "^7.1.0",
"@babel/core": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"@novemberborn/as-i-preach": "^10.1.0",
"ava": "1.0.0-beta.8",
"codecov": "^3.1.0",
"concordance": "^4.0.0",
"nyc": "^13.0.1",
"react": "^16.5.2",
"react-test-renderer": "^16.5.2"
},
"as-i-preach": {
"allowDevDependencies": [
"test/**/*.js",
"test/**/*.jsx"
],
"ignore": [
"test/fixtures/react/*.js"
]
},
"ava": {
"babel": {
"testOptions": {
"presets": [
"module:@babel/preset-react"
]
}
}
},
"nyc": {
"reporter": [
"html",
"lcov",
"text"
]
},
"standard-engine": "@novemberborn/as-i-preach"
}