diff --git a/src/reactivity/reactive.ts b/src/reactivity/reactive.ts index d63e7b1f..5fbf8fe7 100644 --- a/src/reactivity/reactive.ts +++ b/src/reactivity/reactive.ts @@ -212,7 +212,7 @@ export function shallowReactive(obj: any): any { export function reactive(obj: T): UnwrapRef { if (!isObject(obj)) { if (__DEV__) { - warn('"reactive()" is called without provide an "object".') + warn('"reactive()" must be called on an object.') } return obj as any } diff --git a/test/apis/state.spec.js b/test/apis/state.spec.js index 2469d2be..c2861ab1 100644 --- a/test/apis/state.spec.js +++ b/test/apis/state.spec.js @@ -92,11 +92,11 @@ describe('api/reactive', () => { warn = jest.spyOn(global.console, 'error').mockImplementation(() => null) reactive() expect(warn.mock.calls[0][0]).toMatch( - '[Vue warn]: "reactive()" is called without provide an "object".' + '[Vue warn]: "reactive()" must be called on an object.' ) reactive(false) expect(warn.mock.calls[1][0]).toMatch( - '[Vue warn]: "reactive()" is called without provide an "object".' + '[Vue warn]: "reactive()" must be called on an object.' ) expect(warn).toBeCalledTimes(2) warn.mockRestore() diff --git a/test/v3/reactivity/reactive.spec.ts b/test/v3/reactivity/reactive.spec.ts index 7719a1e9..19dbe534 100644 --- a/test/v3/reactivity/reactive.spec.ts +++ b/test/v3/reactivity/reactive.spec.ts @@ -189,7 +189,7 @@ describe('reactivity/reactive', () => { expect( warn.mock.calls.map((call) => { expect(call[0]).toBe( - '[Vue warn]: "reactive()" is called without provide an "object".' + '[Vue warn]: "reactive()" must be called on an object.' ) }) ) @@ -266,7 +266,7 @@ describe('reactivity/reactive', () => { expect( warn.mock.calls.map((call) => { expect(call[0]).toBe( - '[Vue warn]: "shallowReactive()" is called without provide an "object".' + '[Vue warn]: "shallowReactive()" must be called on an object.' ) }) )