8000 chore: add lint cache by Simon-He95 · Pull Request #2052 · vuejs/vue-test-utils · GitHub
[go: up one dir, main page]

Skip to content

chore: add lint cache #2052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: update
  • Loading branch information
Simon-He95 committed Feb 8, 2023
commit 2f5051934f07ac73947db7b2dab13071da949f0c
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dist
**/dist/**
100 changes: 47 additions & 53 deletions packages/server-test-utils/dist/vue-server-test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
var Vue__default = /*#__PURE__*/_interopDefaultLegacy(Vue);
var cheerio__default = /*#__PURE__*/_interopDefaultLegacy(cheerio);

//
//

function createVNodes(vm, slotValue, name) {
var el = vueTemplateCompiler.compileToFunctions(
Expand Down Expand Up @@ -1698,7 +1698,7 @@ var CREATE_ELEMENT_ALIAS = semver.gt(Vue__default['default'].version, '2.1.5')
? '_c'
: '_h';

//
//

function findDOMNodes(
element,
Expand All @@ -1716,7 +1716,7 @@ function findDOMNodes(
return nodes.concat([].slice.call(element.querySelectorAll(selector)))
}

//
//

function isDomSelector(selector) {
if (typeof selector !== 'string') {
Expand Down Expand Up @@ -1750,7 +1750,7 @@ function isVueComponent(c) {
return true
}

if (!isPlainObject(c)) {
if (c === null || typeof c !== 'object') {
return false
}

Expand Down Expand Up @@ -1780,7 +1780,7 @@ function componentNeedsCompiling(component) {

function isRefSelector(refOptionsObject) {
if (
!isPlainObject(refOptionsObject) ||
typeof refOptionsObject !== 'object' ||
Object.keys(refOptionsObject || {}).length !== 1
) {
return false
Expand All @@ -1790,7 +1790,7 @@ function isRefSelector(refOptionsObject) {
}

function isNameSelector(nameOptionsObject) {
if (!isPlainObject(nameOptionsObject)) {
if (typeof nameOptionsObject !== 'object' || nameOptionsObject === null) {
return false
}

Expand All @@ -1806,7 +1806,7 @@ function isDynamicComponent(c) {
}

function isComponentOptions(c) {
return isPlainObject(c) && (c.template || c.render)
return c !== null && typeof c === 'object' && (c.template || c.render)
}

function isFunctionalComponent(c) {
Expand Down Expand Up @@ -1848,10 +1848,10 @@ function makeMap(str, expectsLowerCase) {
map[list[i]] = true;
}
return expectsLowerCase
? function (val) {
? function(val) {
return map[val.toLowerCase()]
}
: function (val) {
: function(val) {
return map[val]
}
}
Expand Down Expand Up @@ -1961,7 +1961,7 @@ function matches(node, selector) {
return vmMatchesName(componentInstance, nameSelector)
}

//
//

function findAllInstances(rootVm) {
var instances = [rootVm];
Expand Down Expand Up @@ -2099,7 +2099,7 @@ function normalizeProvide(provide) {
return provide
}

//
//

function getOption(option, config) {
if (option === false) {
Expand Down Expand Up @@ -7545,7 +7545,7 @@ function ocd(str, options) {
.replace(/>(\s*)(?=<!--\s*\/)/g, '> ');
}

//
//

function getSelectorType(selector) {
if (isDomSelector(selector)) { return DOM_SELECTOR }
Expand Down Expand Up @@ -7573,7 +7573,7 @@ function getSelector(
}
}

//
//

var WrapperArray = function WrapperArray(wrappers) {
var length = wrappers.length;
Expand Down Expand Up @@ -7799,7 +7799,7 @@ WrapperArray.prototype.destroy = function destroy () {
this.wrappers.forEach(function (wrapper) { return wrapper.destroy(); });
};

//
//

var buildSelectorString = function (selector) {
if (getSelectorType(selector) === REF_SELECTOR) {
Expand Down Expand Up @@ -8084,10 +8084,7 @@ ErrorWrapper.prototype.destroy = function destroy () {
*/

function isStyleVisible(element) {
if (
!(element instanceof window.HTMLElement) &&
!(element instanceof window.SVGElement)
) {
if (!(element instanceof HTMLElement) && !(element instanceof SVGElement)) {
return false
}

Expand Down Expand Up @@ -9487,7 +9484,7 @@ function createDOMEvent(type, options) {
return event
}

//
//

var Wrapper = function Wrapper(
node,
Expand Down Expand Up @@ -9964,7 +9961,9 @@ Wrapper.prototype.overview = function overview () {
var emittedJSONReplacer = function (key, value) { return value instanceof Array
? value.map(function (calledWith, index) {
var callParams = calledWith.map(function (param) { return typeof param === 'object'
? JSON.stringify(param).replace(/"/g, '').replace(/,/g, ', ')
? JSON.stringify(param)
.replace(/"/g, '')
.replace(/,/g, ', ')
: param; }
);

Expand Down Expand Up @@ -10188,7 +10187,8 @@ Wrapper.prototype.setProps = function setProps (data) {
Object.keys(data).forEach(function (key) {
// Don't let people set entire objects, because reactivity won't work
if (
isPlainObject(data[key]) &&
typeof data[key] === 'object' &&
data[key] !== null &&
// $FlowIgnore : Problem with possibly null this.vm
data[key] === this$1.vm[key]
) {
Expand Down Expand Up @@ -10359,7 +10359,7 @@ Wrapper.prototype.trigger = function trigger (type, options) {
return nextTick()
};

//
//

var VueWrapper = /*@__PURE__*/(function (Wrapper) {
function VueWrapper(vm, options) {
Expand Down Expand Up @@ -10398,7 +10398,7 @@ var VueWrapper = /*@__PURE__*/(function (Wrapper) {
return VueWrapper;
}(Wrapper));

//
//

function createWrapper(
node,
Expand Down Expand Up @@ -12900,7 +12900,7 @@ function cloneDeep(value) {

var cloneDeep_1 = cloneDeep;

//
//

/**
* Used internally by vue-server-test-utils and test-utils to propagate/create vue instances.
Expand Down Expand Up @@ -12969,7 +12969,7 @@ function _createLocalVue(
return instance
}

//
//

function compileTemplate(component) {
if (component.template) {
Expand Down Expand Up @@ -13024,7 +13024,7 @@ function compileTemplateForSlots(slots) {
});
}

//
//

function isValidSlot(slot) {
return isVueComponent(slot) || typeof slot === 'string'
Expand Down Expand Up @@ -13121,7 +13121,7 @@ function validateOptions(options, component) {
Vue__default['default'].config.productionTip = false;
Vue__default['default'].config.devtools = false;

//
//

function throwError(msg) {
throw new Error(("[vue-test-utils]: " + msg))
Expand Down Expand Up @@ -13234,7 +13234,7 @@ function isVueWrapper(wrapper) {
return wrapper.vm || wrapper.isFunctionalComponent
}

//
//

function addMocks(
_Vue,
Expand All @@ -13261,7 +13261,7 @@ function addMocks(
});
}

//
//

function logEvents(
vm,
Expand All @@ -13280,7 +13280,7 @@ function logEvents(

function addEventLogger(_Vue) {
_Vue.mixin({
beforeCreate: function () {
beforeCreate: function() {
this.__emitted = Object.create(null);
this.__emittedByOrder = [];
logEvents(this, this.__emitted, this.__emittedByOrder);
Expand All @@ -13298,7 +13298,7 @@ function addStubs(_Vue, stubComponents) {
_Vue.mixin(( obj = {}, obj[BEFORE_RENDER_LIFECYCLE_HOOK] = addStubComponentsMixin, obj ));
}

//
//

var MOUNTING_OPTIONS = [
'attachToDocument',
Expand All @@ -13322,13 +13322,15 @@ function extractInstanceOptions(options) {
return instanceOptions
}

//
//

function isDestructuringSlotScope(slotScope) {
return /^{.*}$/.test(slotScope)
}

function getVueTemplateCompilerHelpers(_Vue) {
function getVueTemplateCompilerHelpers(
_Vue
) {
// $FlowIgnore
var vue = new _Vue();
var helpers = {};
Expand Down Expand Up @@ -13427,7 +13429,7 @@ function createScopedSlots(

var slotScope = scopedSlotMatches.match && scopedSlotMatches.match[1];

scopedSlots[scopedSlotName] = function (props) {
scopedSlots[scopedSlotName] = function(props) {
var obj;

var res;
Expand All @@ -13449,7 +13451,7 @@ function createScopedSlots(
return scopedSlots
}

//
//

var FUNCTION_PLACEHOLDER = '[Function]';

Expand All @@ -13476,10 +13478,10 @@ function resolveComponent$1(obj, component) {
)
}

function getCoreProperties(componentOptions, name) {
function getCoreProperties(componentOptions) {
return {
attrs: componentOptions.attrs,
name: componentOptions.name || name,
name: componentOptions.name,
model: componentOptions.model,
props: componentOptions.props,
on: componentOptions.on,
Expand Down Expand Up @@ -13540,7 +13542,7 @@ function createStubFromComponent(
Vue__default['default'].config.ignoredElements.push(tagName);
}

return Object.assign({}, getCoreProperties(componentOptions, name),
return Object.assign({}, getCoreProperties(componentOptions),
{$_vueTestUtils_original: originalComponent,
$_doNotStubChildren: true,
render: function render(h, context) {
Expand Down Expand Up @@ -13721,16 +13723,8 @@ function patchCreateElement(_Vue, stubs, stubAllComponents) {
}

if (isConstructor(el) || isComponentOptions(el)) {
var componentOptions = isConstructor(el) ? el.options : 10000 el;
var elName = componentOptions.name;

var stubbedComponent = resolveComponent(elName, stubs);
if (stubbedComponent) {
return originalCreateElement.apply(void 0, [ stubbedComponent ].concat( args ))
}

if (stubAllComponents) {
var stub = createStubFromComponent(el, elName || 'anonymous', _Vue);
var stub = createStubFromComponent(el, el.name || 'anonymous', _Vue);
return originalCreateElement.apply(void 0, [ stub ].concat( args ))
}
var Constructor = shouldExtend(el) ? extend(el, _Vue) : el;
Expand Down Expand Up @@ -13767,7 +13761,7 @@ function patchCreateElement(_Vue, stubs, stubAllComponents) {
_Vue.mixin(( obj = {}, obj[BEFORE_RENDER_LIFECYCLE_HOOK] = patchCreateElementMixin, obj ));
}

//
//

function objectWithoutProperties (obj, exclude) { var target = {}; for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k) && exclude.indexOf(k) === -1) target[k] = obj[k]; return target; }

Expand Down Expand Up @@ -13864,22 +13858,22 @@ function createInstance(
var parentComponentOptions = options.parentComponent || {};

var originalParentComponentProvide = parentComponentOptions.provide;
parentComponentOptions.provide = function () {
parentComponentOptions.provide = function() {
return Object.assign({}, getValuesFromCallableOption.call(this, originalParentComponentProvide),
// $FlowIgnore
getValuesFromCallableOption.call(this, options.provide))
};

var originalParentComponentData = parentComponentOptions.data;
parentComponentOptions.data = function () {
parentComponentOptions.data = function() {
return Object.assign({}, getValuesFromCallableOption.call(this, originalParentComponentData),
{vueTestUtils_childProps: Object.assign({}, options.propsData)})
};

parentComponentOptions.$_doNotStubChildren = true;
parentComponentOptions.$_isWrapperParent = true;
parentComponentOptions._isFunctionalContainer = componentOptions.functional;
parentComponentOptions.render = function (h) {
parentComponentOptions.render = function(h) {
return h(
Constructor,
createContext(options, scopedSlots, this.vueTestUtils_childProps),
Expand All @@ -13901,7 +13895,7 @@ function createInstance(

var config$1 = testUtils.config;

//
//

Vue__default['default'].config.productionTip = false;
Vue__default['default'].config.devtools = false;
Expand Down Expand Up @@ -13936,7 +13930,7 @@ function renderToString(
return renderer.renderToString(vm)
}

//
//

function render(
component,
Expand Down
Loading
0