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.5
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.6
Choose a head ref
  • 3 commits
  • 13 files changed
  • 3 contributors

Commits on Aug 7, 2023

  1. chore(deps): bump json5 from 1.0.1 to 1.0.2 (#526)

    Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
    - [Release notes](https://github.com/json5/json5/releases)
    - [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
    - [Commits](json5/json5@v1.0.1...v1.0.2)
    
    ---
    updated-dependencies:
    - dependency-name: json5
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
    dependabot[bot] and lmiller1990 authored Aug 7, 2023

    Verified

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

Commits on Sep 6, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b0c843a View commit details
  2. publish: 29.2.6

    lmiller1990 committed Sep 6, 2023
    Copy the full SHA
    d61d430 View commit details
1 change: 1 addition & 0 deletions e2e/2.x/style/colors.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@primary-color: "red";
1 change: 1 addition & 0 deletions e2e/2.x/style/colors.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$primary-color: #333;
4 changes: 3 additions & 1 deletion e2e/2.x/style/variables.less
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
@primary-color: "red";
@import "./colors.less";

@font-size: 16px;
4 changes: 3 additions & 1 deletion e2e/2.x/style/variables.scss
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
$primary-color: #333;
@import './colors.scss';

$font-size: 16px;
1 change: 1 addition & 0 deletions e2e/3.x/style/colors.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@primary-color: "red";
1 change: 1 addition & 0 deletions e2e/3.x/style/colors.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$primary-color: #333;
4 changes: 3 additions & 1 deletion e2e/3.x/style/variables.less
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
@primary-color: "red";
@import "./colors.less";

@font-size: 16px;
4 changes: 3 additions & 1 deletion e2e/3.x/style/variables.scss
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
$primary-color: #333;
@import './colors.scss';

$font-size: 16px;
19 changes: 14 additions & 5 deletions packages/vue2-jest/lib/process-style.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const path = require('path')
const fs = require('fs')
const cssTree = require('css-tree')
const getVueJestConfig = require('./utils').getVueJestConfig
const compileStyle = require('@vue/component-compiler-utils').compileStyle
@@ -12,14 +11,23 @@ function getGlobalResources(resources, lang) {
let globalResources = ''
if (resources && resources[lang]) {
globalResources = resources[lang]
.map(resource => path.resolve(process.cwd(), resource))
.filter(resourcePath => fs.existsSync(resourcePath))
.map(resourcePath => fs.readFileSync(resourcePath).toString())
.join('\n')
.map(resource => {
const absolutePath = path.resolve(process.cwd(), resource)
return `${getImportLine(lang, absolutePath)}\n`
})
.join('')
}
return globalResources
}

function getImportLine(lang, filePath) {
const importLines = {
default: `@import "${filePath}";`,
sass: `@import "${filePath}"`
}
return importLines[lang] || importLines.default
}

function extractClassMap(cssCode) {
const ast = cssTree.parse(cssCode)

@@ -35,6 +43,7 @@ function extractClassMap(cssCode) {
function getPreprocessOptions(lang, filePath, jestConfig) {
if (lang === 'scss' || lang === 'sass') {
return {
filename: filePath,
importer: (url, prev, done) => ({
file: applyModuleNameMapper(
url,
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.5",
"version": "29.2.6",
"description": "Jest transformer for Vue 2",
"main": "lib/index.js",
"files": [
19 changes: 14 additions & 5 deletions packages/vue3-jest/lib/process-style.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const { compileStyle } = require('@vue/compiler-sfc')
const path = require('path')
const fs = require('fs')
const cssTree = require('css-tree')
const getVueJestConfig = require('./utils').getVueJestConfig
const applyModuleNameMapper = require('./module-name-mapper-helper')
@@ -12,14 +11,23 @@ function getGlobalResources(resources, lang) {
let globalResources = ''
if (resources && resources[lang]) {
globalResources = resources[lang]
.map(resource => path.resolve(process.cwd(), resource))
.filter(resourcePath => fs.existsSync(resourcePath))
.map(resourcePath => fs.readFileSync(resourcePath).toString())
.join('\n')
.map(resource => {
const absolutePath = path.resolve(process.cwd(), resource)
return `${getImportLine(lang, absolutePath)}\n`
})
.join('')
}
return globalResources
}

function getImportLine(lang, filePath) {
const importLines = {
default: `@import "${filePath}";`,
sass: `@import "${filePath}"`
}
return importLines[lang] || importLines.default
}

function extractClassMap(cssCode) {
const ast = cssTree.parse(cssCode)

@@ -35,6 +43,7 @@ function extractClassMap(cssCode) {
function getPreprocessOptions(lang, filePath, jestConfig) {
if (lang === 'scss' || lang === 'sass') {
return {
filename: filePath,
importer: (url, prev) => ({
file: applyModuleNameMapper(
url,
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.5",
"version": "29.2.6",
"description": "Jest Vue transform",
"main": "lib/index.js",
"files": [
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -6530,9 +6530,9 @@ json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1:
integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=

json5@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==
version "1.0.2"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593"
integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==
dependencies:
minimist "^1.2.0"

@@ -7410,9 +7410,9 @@ minimist-options@^3.0.1:
is-plain-obj "^1.1.0"

minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5:
version "1.2.5"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
version "1.2.7"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18"
integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==

minipass@^2.3.5, minipass@^2.6.0, minipass@^2.9.0:
version "2.9.0"
@@ -10860,7 +10860,7 @@ vue-template-es2015-compiler@^1.9.0:
"vue2-sass-importer-lib@file:e2e/2.x/sass-importer/lib":
version "1.0.0"
dependencies:
vue2-sass-importer-sass-lib "file:../../Library/Caches/Yarn/v6/npm-vue2-sass-importer-lib-1.0.0-ccaeac9e-c707-4bf2-843f-2b6514207308-1690815365364/node_modules/sass-lib-v1"
vue2-sass-importer-sass-lib "file:../../../Library/Caches/Yarn/v6/npm-vue2-sass-importer-lib-1.0.0-c8ecb622-3c66-45e7-a49b-7fe0cf212f02-1691365665246/node_modules/sass-lib-v1"

"vue2-sass-importer-sass-lib@file:e2e/2.x/sass-importer/sass-lib-v1":
version "1.0.0"
@@ -10871,7 +10871,7 @@ vue-template-es2015-compiler@^1.9.0:
"vue3-sass-importer-lib@file:e2e/3.x/sass-importer/lib":
version "1.0.0"
dependencies:
vue3-sass-importer-sass-lib "file:../../Library/Caches/Yarn/v6/npm-vue3-sass-importer-lib-1.0.0-32edd869-08a1-4b33-835d-626fdeb0344c-1690815365364/node_modules/sass-lib-v1"
vue3-sass-importer-sass-lib "file:../../../Library/Caches/Yarn/v6/npm-vue3-sass-importer-lib-1.0.0-8ffc19e9-f75c-4094-8154-77cbd93d14ce-1691365665246/node_modules/sass-lib-v1"

"vue3-sass-importer-sass-lib@file:e2e/3.x/sass-importer/sass-lib-v1":
version "1.0.0"