refactor: move mockWarn utility to @vue/shared

close #652
This commit is contained in:
Evan You 2020-01-22 09:29:35 -05:00
parent 95a8beb787
commit 2569890e31
20 changed files with 24 additions and 26 deletions

View File

@ -1,5 +1,5 @@
import { compileStyle } from '../src/compileStyle' import { compileStyle } from '../src/compileStyle'
import { mockWarn } from '@vue/runtime-test' import { mockWarn } from '@vue/shared'
function compile(source: string): string { function compile(source: string): string {
const res = compileStyle({ const res = compileStyle({

View File

@ -1,5 +1,5 @@
import { parse } from '../src' import { parse } from '../src'
import { mockWarn } from '@vue/runtime-test' import { mockWarn } from '@vue/shared'
import { baseParse, baseCompile } from '@vue/compiler-core' import { baseParse, baseCompile } from '@vue/compiler-core'
describe('compiler:sfc', () => { describe('compiler:sfc', () => {

View File

@ -6,7 +6,7 @@ import {
ref, ref,
WritableComputedRef WritableComputedRef
} from '../src' } from '../src'
import { mockWarn } from '@vue/runtime-test' import { mockWarn } from '@vue/shared'
describe('reactivity/computed', () => { describe('reactivity/computed', () => {
mockWarn() mockWarn()

View File

@ -1,6 +1,6 @@
import { ref, isRef } from '../src/ref' import { ref, isRef } from '../src/ref'
import { reactive, isReactive, toRaw, markNonReactive } from '../src/reactive' import { reactive, isReactive, toRaw, markNonReactive } from '../src/reactive'
import { mockWarn } from '@vue/runtime-test' import { mockWarn } from '@vue/shared'
import { computed } from '../src/computed' import { computed } from '../src/computed'
describe('reactivity/reactive', () => { describe('reactivity/reactive', () => {

View File

@ -12,7 +12,7 @@ import {
ref, ref,
shallowReadonly shallowReadonly
} from '../src' } from '../src'
import { mockWarn } from '@vue/runtime-test' import { mockWarn } from '@vue/shared'
/** /**
* @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html

View File

@ -3,7 +3,6 @@ import {
h, h,
nodeOps, nodeOps,
serializeInner, serializeInner,
mockWarn,
provide, provide,
inject, inject,
resolveComponent, resolveComponent,
@ -13,6 +12,7 @@ import {
ref, ref,
getCurrentInstance getCurrentInstance
} from '@vue/runtime-test' } from '@vue/runtime-test'
import { mockWarn } from '@vue/shared'
describe('api: createApp', () => { describe('api: createApp', () => {
mockWarn() mockWarn()

View File

@ -9,7 +9,8 @@ import {
readonly, readonly,
reactive reactive
} from '../src/index' } from '../src/index'
import { render, nodeOps, serialize, mockWarn } from '@vue/runtime-test' import { render, nodeOps, serialize } from '@vue/runtime-test'
import { mockWarn } from '@vue/shared'
// reference: https://vue-composition-api-rfc.netlify.com/api.html#provide-inject // reference: https://vue-composition-api-rfc.netlify.com/api.html#provide-inject

View File

@ -8,9 +8,9 @@ import {
nextTick, nextTick,
renderToString, renderToString,
ref, ref,
defineComponent, defineComponent
mockWarn
} from '@vue/runtime-test' } from '@vue/runtime-test'
import { mockWarn } from '@vue/shared'
describe('api: options', () => { describe('api: options', () => {
test('data', async () => { test('data', async () => {

View File

@ -1,11 +1,12 @@
import { watch, reactive, computed, nextTick, ref, h } from '../src/index' import { watch, reactive, computed, nextTick, ref, h } from '../src/index'
import { render, nodeOps, serializeInner, mockWarn } from '@vue/runtime-test' import { render, nodeOps, serializeInner } from '@vue/runtime-test'
import { import {
ITERATE_KEY, ITERATE_KEY,
DebuggerEvent, DebuggerEvent,
TrackOpTypes, TrackOpTypes,
TriggerOpTypes TriggerOpTypes
} from '@vue/reactivity' } from '@vue/reactivity'
import { mockWarn } from '@vue/shared'
// reference: https://vue-composition-api-rfc.netlify.com/api.html#watch // reference: https://vue-composition-api-rfc.netlify.com/api.html#watch

View File

@ -1,9 +1,5 @@
import { import { createApp, getCurrentInstance, nodeOps } from '@vue/runtime-test'
createApp, import { mockWarn } from '@vue/shared'
getCurrentInstance,
nodeOps,
mockWarn
} from '@vue/runtime-test'
import { ComponentInternalInstance } from '../src/component' import { ComponentInternalInstance } from '../src/component'
describe('component: proxy', () => { describe('component: proxy', () => {

View File

@ -7,10 +7,10 @@ import {
watch, watch,
ref, ref,
nextTick, nextTick,
mockWarn,
defineComponent defineComponent
} from '@vue/runtime-test' } from '@vue/runtime-test'
import { setErrorRecovery } from '../src/errorHandling' import { setErrorRecovery } from '../src/errorHandling'
import { mockWarn } from '@vue/shared'
describe('error handling', () => { describe('error handling', () => {
mockWarn() mockWarn()

View File

@ -1,5 +1,4 @@
import { import {
mockWarn,
createApp, createApp,
nodeOps, nodeOps,
resolveComponent, resolveComponent,
@ -9,6 +8,7 @@ import {
resolveDynamicComponent, resolveDynamicComponent,
getCurrentInstance getCurrentInstance
} from '@vue/runtime-test' } from '@vue/runtime-test'
import { mockWarn } from '@vue/shared'
describe('resolveAssets', () => { describe('resolveAssets', () => {
test('should work', () => { test('should work', () => {

View File

@ -1,5 +1,5 @@
import { toHandlers } from '../../src/helpers/toHandlers' import { toHandlers } from '../../src/helpers/toHandlers'
import { mockWarn } from '@vue/runtime-test' import { mockWarn } from '@vue/shared'
describe('toHandlers', () => { describe('toHandlers', () => {
mockWarn() mockWarn()

View File

@ -8,7 +8,7 @@ import {
onUpdated, onUpdated,
defineComponent defineComponent
} from '@vue/runtime-dom' } from '@vue/runtime-dom'
import { mockWarn } from '@vue/runtime-test' import { mockWarn } from '@vue/shared'
describe('attribute fallthrough', () => { describe('attribute fallthrough', () => {
mockWarn() mockWarn()

View File

@ -6,9 +6,9 @@ import {
NodeTypes, NodeTypes,
TestElement, TestElement,
serialize, serialize,
serializeInner, serializeInner
mockWarn
} from '@vue/runtime-test' } from '@vue/runtime-test'
import { mockWarn } from '@vue/shared'
mockWarn() mockWarn()

View File

@ -12,9 +12,9 @@ import {
NodeOpTypes, NodeOpTypes,
nextTick, nextTick,
serialize, serialize,
triggerEvent, triggerEvent
mockWarn
} from '../src' } from '../src'
import { mockWarn } from '@vue/shared'
describe('test renderer', () => { describe('test renderer', () => {
mockWarn() mockWarn()

View File

@ -26,5 +26,4 @@ export function renderToString(vnode: VNode) {
export * from './triggerEvent' export * from './triggerEvent'
export * from './serialize' export * from './serialize'
export * from './nodeOps' export * from './nodeOps'
export * from './utils/mockWarn'
export * from '@vue/runtime-core' export * from '@vue/runtime-core'

View File

@ -5,6 +5,7 @@ export * from './patchFlags'
export * from './globalsWhitelist' export * from './globalsWhitelist'
export * from './codeframe' export * from './codeframe'
export * from './domTagConfig' export * from './domTagConfig'
export * from './mockWarn'
export const EMPTY_OBJ: { readonly [key: string]: any } = __DEV__ export const EMPTY_OBJ: { readonly [key: string]: any } = __DEV__
? Object.freeze({}) ? Object.freeze({})

View File

@ -1,5 +1,5 @@
import { createApp } from '../src' import { createApp } from '../src'
import { mockWarn } from '@vue/runtime-test' import { mockWarn } from '@vue/shared'
describe('compiler + runtime integration', () => { describe('compiler + runtime integration', () => {
mockWarn() mockWarn()