Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vuejs/vue-jest
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v29.2.2
Choose a base ref
...
head repository: vuejs/vue-jest
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v29.2.3
Choose a head ref
  • 2 commits
  • 5 files changed
  • 2 contributors

Commits on Dec 11, 2022

  1. publish: 29.2.2

    lmiller1990 committed Dec 11, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3dc76ff View commit details

Commits on Mar 2, 2023

  1. Copy the full SHA
    36c6d97 View commit details
Showing with 39 additions and 4 deletions.
  1. +23 −0 e2e/2.x/basic/components/ScriptAndScriptSetup.vue
  2. +7 −0 e2e/2.x/basic/test.js
  3. +7 −2 packages/vue2-jest/lib/process.js
  4. +1 −1 packages/vue2-jest/package.json
  5. +1 −1 packages/vue3-jest/package.json
23 changes: 23 additions & 0 deletions e2e/2.x/basic/components/ScriptAndScriptSetup.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template>
<div>
<button @click="increase">Products: {{ products }}</button>
<Basic />
<span>{{ msg }}</span>
</div>
</template>

<script>
import Basic from './Basic.vue'
</script>

<script setup>
import { ref } from 'vue'
const products = ref(10)
const greet = () => console.log('greet')
const increase = () => {
greet()
num.value++
}
const msg = 'hello world'
</script>
7 changes: 7 additions & 0 deletions e2e/2.x/basic/test.js
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ import Jsx from './components/Jsx.vue'
import Constructor from './components/Constructor.vue'
import { compileStyle } from '@vue/component-compiler-utils'
import ScriptSetup from './components/ScriptSetup'
import ScriptAndScriptSetup from './components/ScriptAndScriptSetup'
import ExtendedTsConfig from './components/ExtendedTsConfig.vue'

jest.mock('@vue/component-compiler-utils', () => ({
@@ -165,6 +166,12 @@ test('processes SFC with <script setup>', () => {
expect(wrapper.html()).toContain('Welcome to Your Vue.js App')
})

test('processes SFC with both <script> and <script setup> in same component file', () => {
const wrapper = mount(ScriptAndScriptSetup)
expect(wrapper.html()).toContain('Products: 10')
expect(wrapper.html()).toContain('Welcome to Your Vue.js App')
})

test('handles extended tsconfig.json files', () => {
const wrapper = mount(ExtendedTsConfig)
expect(wrapper.element.tagName).toBe('DIV')
9 changes: 7 additions & 2 deletions packages/vue2-jest/lib/process.js
Original file line number Diff line number Diff line change
@@ -144,15 +144,20 @@ module.exports = function(src, filename, config) {
})

const templateResult = processTemplate(descriptor, filename, config)
const scriptResult = processScript(descriptor.script, filename, config)
const scriptSetupResult = processScriptSetup(descriptor, filename, config)
const stylesResult = processStyle(descriptor.styles, filename, config)
const customBlocksResult = processCustomBlocks(
descriptor.customBlocks,
filename,
config
)

let scriptResult
const scriptSetupResult = processScriptSetup(descriptor, filename, config)

if (!scriptSetupResult) {
scriptResult = processScript(descriptor.script, filename, config)
}

const isFunctional =
(descriptor.template &&
descriptor.template.attrs &&
2 changes: 1 addition & 1 deletion packages/vue2-jest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue/vue2-jest",
"version": "29.2.1",
"version": "29.2.2",
"description": "Jest transformer for Vue 2",
"main": "lib/index.js",
"files": [
2 changes: 1 addition & 1 deletion packages/vue3-jest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue/vue3-jest",
"version": "29.2.1",
"version": "29.2.2",
"description": "Jest Vue transform",
"main": "lib/index.js",
"files": [