Skip to content

Commit

Permalink
test(vue3): adding e2e tests for sass-importer
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Hines committed Jun 24, 2022
1 parent c5d1a69 commit 932c9bc
Show file tree
Hide file tree
Showing 11 changed files with 155 additions and 1 deletion.
4 changes: 4 additions & 0 deletions e2e/3.x/sass-importer/entry/babel-transformer.js
@@ -0,0 +1,4 @@
const { createTransformer } = require('babel-jest').default
module.exports = createTransformer({
presets: ['@babel/preset-env']
})
24 changes: 24 additions & 0 deletions e2e/3.x/sass-importer/entry/components/Entry.vue
@@ -0,0 +1,24 @@
<template>
<div>
<h1 class="entry">Entry</h1>
<lib-component />
</div>
</template>

<script>
import LibComponent from 'vue3-sass-importer-lib/index.vue'
export default {
components: {
LibComponent
}
}
</script>

<style lang="scss" module>
@import '~vue3-sass-importer-sass-lib/index.scss';
.entry {
@include my-v2-mixin;
}
</style>
48 changes: 48 additions & 0 deletions e2e/3.x/sass-importer/entry/package.json
@@ -0,0 +1,48 @@
{
"name": "vue3-sass-importer-entry",
"version": "1.0.0",
"license": "MIT",
"private": true,
"scripts": {
"test": "jest --no-cache --coverage test.js"
},
"dependencies": {
"vue": "^3.2.22",
"vue3-sass-importer-lib": "file:../lib",
"vue3-sass-importer-sass-lib": "file:../sass-lib-v2"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.0",
"@vue/test-utils": "^1.1.0",
"babel-jest": "^28.0.2",
"jest": "28.x",
"jest-environment-jsdom": "28.0.2",
"postcss": "^7.0.13",
"postcss-color-function": "^4.0.1",
"sass": "^1.23.7",
"@vue/vue3-jest": "^28.0.0"
},
"jest": {
"testEnvironment": "jsdom",
"moduleFileExtensions": [
"js",
"json",
"vue"
],
"transformIgnorePatterns": [
"/node_modules/.*(?<!.vue)$"
],
"transform": {
"^.+\\.js$": "./babel-transformer.js",
"^.+\\.vue$": "@vue/vue3-jest"
},
"globals": {
"vue-jest": {
"transform": {
"^js$": "./babel-transformer.js"
}
}
}
}
}
7 changes: 7 additions & 0 deletions e2e/3.x/sass-importer/entry/test.js
@@ -0,0 +1,7 @@
import { mount } from '@vue/test-utils'
import Entry from './components/Entry.vue'

test('processes sass imports relative to current file', () => {
const wrapper = mount(Entry)
expect(wrapper).toBeDefined()
})
11 changes: 11 additions & 0 deletions e2e/3.x/sass-importer/lib/index.vue
@@ -0,0 +1,11 @@
<template>
<div class="lib-class">Lib Component</div>
</template>

<style lang="scss" module>
@import '~vue3-sass-importer-sass-lib/index.scss';
.lib-class {
@include my-v1-mixin;
}
</style>
19 changes: 19 additions & 0 deletions e2e/3.x/sass-importer/lib/package.json
@@ -0,0 +1,19 @@
{
"name": "vue3-sass-importer-lib",
"version": "1.0.0",
"license": "MIT",
"private": true,
"main": "index.vue",
"files": [
"index.vue"
],
"scripts": {
"test": "echo 'No tests found.'"
},
"dependencies": {
"vue3-sass-importer-sass-lib": "file:../sass-lib-v1"
},
"peerDependencies": {
"vue": "^3.2.22"
}
}
3 changes: 3 additions & 0 deletions e2e/3.x/sass-importer/sass-lib-v1/index.scss
@@ -0,0 +1,3 @@
@mixin my-v1-mixin {
color: blue;
}
12 changes: 12 additions & 0 deletions e2e/3.x/sass-importer/sass-lib-v1/package.json
@@ -0,0 +1,12 @@
{
"name": "vue3-sass-importer-sass-lib",
"version": "1.0.0",
"license": "MIT",
"private": true,
"files": [
"index.scss"
],
"scripts": {
"test": "echo 'No tests found.'"
}
}
3 changes: 3 additions & 0 deletions e2e/3.x/sass-importer/sass-lib-v2/index.scss
@@ -0,0 +1,3 @@
@mixin my-v2-mixin {
color: red;
}
12 changes: 12 additions & 0 deletions e2e/3.x/sass-importer/sass-lib-v2/package.json
@@ -0,0 +1,12 @@
{
"name": "vue3-sass-importer-sass-lib",
"version": "2.0.0",
"license": "MIT",
"private": true,
"files": [
"index.scss"
],
"scripts": {
"test": "echo 'No tests found.'"
}
}
13 changes: 12 additions & 1 deletion yarn.lock
Expand Up @@ -10868,14 +10868,25 @@ 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:../../.cache/yarn/v6/npm-vue2-sass-importer-lib-1.0.0-c953c300-a005-492f-9652-a1024a3a28b9-1656106782763/node_modules/sass-lib-v1"
vue2-sass-importer-sass-lib "file:../../.cache/yarn/v6/npm-vue2-sass-importer-lib-1.0.0-1087f856-8699-4ac6-a0fa-2288988256c2-1656107462461/node_modules/sass-lib-v1"

"vue2-sass-importer-sass-lib@file:e2e/2.x/sass-importer/sass-lib-v1":
version "1.0.0"

"vue2-sass-importer-sass-lib@file:e2e/2.x/sass-importer/sass-lib-v2":
version "2.0.0"

"vue3-sass-importer-lib@file:e2e/3.x/sass-importer/lib":
version "1.0.0"
dependencies:
vue3-sass-importer-sass-lib "file:../../.cache/yarn/v6/npm-vue3-sass-importer-lib-1.0.0-c866bb73-f527-47b9-932d-498dea4cf3d0-1656107462461/node_modules/sass-lib-v1"

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

"vue3-sass-importer-sass-lib@file:e2e/3.x/sass-importer/sass-lib-v2":
version "2.0.0"

vue@^2.4.2, vue@^2.5.21:
version "2.6.14"
resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.14.tgz#e51aa5250250d569a3fbad3a8a5a687d6036e235"
Expand Down

0 comments on commit 932c9bc

Please sign in to comment.