Skip to content

Commit

Permalink
refactor: move mockWarn utility to @vue/shared
Browse files Browse the repository at this point in the history
close #652
  • Loading branch information
yyx990803 committed Jan 22, 2020
1 parent 95a8beb commit 2569890
Show file tree
Hide file tree
Showing 20 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion packages/compiler-sfc/__tests__/compileStyle.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { compileStyle } from '../src/compileStyle'
import { mockWarn } from '@vue/runtime-test'
import { mockWarn } from '@vue/shared'

function compile(source: string): string {
const res = compileStyle({
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-sfc/__tests__/parse.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { parse } from '../src'
import { mockWarn } from '@vue/runtime-test'
import { mockWarn } from '@vue/shared'
import { baseParse, baseCompile } from '@vue/compiler-core'

describe('compiler:sfc', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/reactivity/__tests__/computed.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ref,
WritableComputedRef
} from '../src'
import { mockWarn } from '@vue/runtime-test'
import { mockWarn } from '@vue/shared'

describe('reactivity/computed', () => {
mockWarn()
Expand Down
2 changes: 1 addition & 1 deletion packages/reactivity/__tests__/reactive.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ref, isRef } from '../src/ref'
import { reactive, isReactive, toRaw, markNonReactive } from '../src/reactive'
import { mockWarn } from '@vue/runtime-test'
import { mockWarn } from '@vue/shared'
import { computed } from '../src/computed'

describe('reactivity/reactive', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/reactivity/__tests__/readonly.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
ref,
shallowReadonly
} 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
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-core/__tests__/apiApp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
h,
nodeOps,
serializeInner,
mockWarn,
provide,
inject,
resolveComponent,
Expand All @@ -13,6 +12,7 @@ import {
ref,
getCurrentInstance
} from '@vue/runtime-test'
import { mockWarn } from '@vue/shared'

describe('api: createApp', () => {
mockWarn()
Expand Down
3 changes: 2 additions & 1 deletion packages/runtime-core/__tests__/apiInject.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {
readonly,
reactive
} 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

Expand Down
4 changes: 2 additions & 2 deletions packages/runtime-core/__tests__/apiOptions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
nextTick,
renderToString,
ref,
defineComponent,
mockWarn
defineComponent
} from '@vue/runtime-test'
import { mockWarn } from '@vue/shared'

describe('api: options', () => {
test('data', async () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/runtime-core/__tests__/apiWatch.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
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 {
ITERATE_KEY,
DebuggerEvent,
TrackOpTypes,
TriggerOpTypes
} from '@vue/reactivity'
import { mockWarn } from '@vue/shared'

// reference: https://vue-composition-api-rfc.netlify.com/api.html#watch

Expand Down
8 changes: 2 additions & 6 deletions packages/runtime-core/__tests__/componentProxy.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import {
createApp,
getCurrentInstance,
nodeOps,
mockWarn
} from '@vue/runtime-test'
import { createApp, getCurrentInstance, nodeOps } from '@vue/runtime-test'
import { mockWarn } from '@vue/shared'
import { ComponentInternalInstance } from '../src/component'

describe('component: proxy', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-core/__tests__/errorHandling.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import {
watch,
ref,
nextTick,
mockWarn,
defineComponent
} from '@vue/runtime-test'
import { setErrorRecovery } from '../src/errorHandling'
import { mockWarn } from '@vue/shared'

describe('error handling', () => {
mockWarn()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
mockWarn,
createApp,
nodeOps,
resolveComponent,
Expand All @@ -9,6 +8,7 @@ import {
resolveDynamicComponent,
getCurrentInstance
} from '@vue/runtime-test'
import { mockWarn } from '@vue/shared'

describe('resolveAssets', () => {
test('should work', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-core/__tests__/helpers/toHandlers.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { toHandlers } from '../../src/helpers/toHandlers'
import { mockWarn } from '@vue/runtime-test'
import { mockWarn } from '@vue/shared'

describe('toHandlers', () => {
mockWarn()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
onUpdated,
defineComponent
} from '@vue/runtime-dom'
import { mockWarn } from '@vue/runtime-test'
import { mockWarn } from '@vue/shared'

describe('attribute fallthrough', () => {
mockWarn()
Expand Down
4 changes: 2 additions & 2 deletions packages/runtime-core/__tests__/rendererChildren.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
NodeTypes,
TestElement,
serialize,
serializeInner,
mockWarn
serializeInner
} from '@vue/runtime-test'
import { mockWarn } from '@vue/shared'

mockWarn()

Expand Down
4 changes: 2 additions & 2 deletions packages/runtime-test/__tests__/testRuntime.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import {
NodeOpTypes,
nextTick,
serialize,
triggerEvent,
mockWarn
triggerEvent
} from '../src'
import { mockWarn } from '@vue/shared'

describe('test renderer', () => {
mockWarn()
Expand Down
1 change: 0 additions & 1 deletion packages/runtime-test/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ export function renderToString(vnode: VNode) {
export * from './triggerEvent'
export * from './serialize'
export * from './nodeOps'
export * from './utils/mockWarn'
export * from '@vue/runtime-core'
1 change: 1 addition & 0 deletions packages/shared/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export * from './patchFlags'
export * from './globalsWhitelist'
export * from './codeframe'
export * from './domTagConfig'
export * from './mockWarn'

export const EMPTY_OBJ: { readonly [key: string]: any } = __DEV__
? Object.freeze({})
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/vue/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createApp } from '../src'
import { mockWarn } from '@vue/runtime-test'
import { mockWarn } from '@vue/shared'

describe('compiler + runtime integration', () => {
mockWarn()
Expand Down

0 comments on commit 2569890

Please sign in to comment.