fix tests

This commit is contained in:
Philipp Kühn 2019-06-12 22:31:16 +02:00
parent 352e8c18a7
commit ee4f132b0f
6 changed files with 41 additions and 18 deletions

View File

@ -2,10 +2,6 @@ module.exports = {
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 3,
},
],
],
plugins: [

View File

@ -3,4 +3,7 @@ module.exports = {
roots: [
'<rootDir>/packages/',
],
moduleNameMapper: {
'\\.(css)$': 'identity-obj-proxy',
},
}

View File

@ -39,7 +39,6 @@
"browser-sync": "^2.26.7",
"connect-history-api-fallback": "^1.6.0",
"copy-webpack-plugin": "^5.0.3",
"core-js": "^3.1.3",
"css-loader": "^3.0.0",
"dart-sass": "^1.21.0",
"eslint": "^5.16.0",
@ -53,11 +52,13 @@
"html-webpack-plugin": "^3.2.0",
"http-proxy-middleware": "^0.19.1",
"http-server": "^0.11.1",
"identity-obj-proxy": "^3.0.0",
"imagemin-webpack-plugin": "^2.4.2",
"jest": "^24.7.1",
"lerna": "^3.15.0",
"mini-css-extract-plugin": "^0.7.0",
"minimist": "^1.2.0",
"mutation-observer": "^1.0.3",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"ora": "^3.4.0",
"postcss": "^7.0.17",

View File

@ -1,13 +1,15 @@
export default function (css) {
const style = document.createElement('style')
style.type = 'text/css'
style.textContent = css
const { head } = document
const { firstChild } = head
if (process.env.NODE_ENV !== 'test') {
const style = document.createElement('style')
style.type = 'text/css'
style.textContent = css
const { head } = document
const { firstChild } = head
if (firstChild) {
head.insertBefore(style, firstChild)
} else {
head.appendChild(style)
if (firstChild) {
head.insertBefore(style, firstChild)
} else {
head.appendChild(style)
}
}
}

View File

@ -1,3 +1,5 @@
// MutationObserver is not supported by JSDom
import MutationObserver from 'mutation-observer'
import Editor from '../src/Editor'
import {
@ -19,6 +21,8 @@ import {
History,
} from '../../tiptap-extensions'
global.MutationObserver = MutationObserver
test('create editor', () => {
const editor = new Editor()

View File

@ -3730,7 +3730,7 @@ core-js@^2.4.0, core-js@^2.6.5:
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.9.tgz#6b4b214620c834152e179323727fc19741b084f2"
integrity sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==
core-js@^3.0.0, core-js@^3.1.3:
core-js@^3.0.0:
version "3.1.3"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.1.3.tgz#95700bca5f248f5f78c0ec63e784eca663ec4138"
integrity sha512-PWZ+ZfuaKf178BIAg+CRsljwjIMRV8MY00CbZczkR6Zk5LfkSkjGoaab3+bqRQWVITNZxQB7TFYz+CFcyuamvA==
@ -4530,9 +4530,9 @@ ee-first@1.1.1:
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
electron-to-chromium@^1.3.150:
version "1.3.157"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.157.tgz#6211d69e8c4ee18df8c84e74e8644bcafc09486c"
integrity sha512-vxGi3lOGqlupuogZxJOMfu+Q1vaOlG6XbsblWw8XnUZSr/ptbt3D6jhHT5LJPZuFUpKhbEo1u4QipivSory1Kg==
version "1.3.158"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.158.tgz#5e16909dcfd25ab7cd1665114ee381083a3ee858"
integrity sha512-wJsJaWsViNQ129XPGmyO5gGs1jPMHr9vffjHAhUje1xZbEzQcqbENdvfyRD9q8UF0TgFQFCCUbaIpJarFbvsIg==
elliptic@^6.0.0:
version "6.4.1"
@ -5777,6 +5777,11 @@ har-validator@~5.1.0:
ajv "^6.5.5"
har-schema "^2.0.0"
harmony-reflect@^1.4.6:
version "1.6.1"
resolved "https://registry.yarnpkg.com/harmony-reflect/-/harmony-reflect-1.6.1.tgz#c108d4f2bb451efef7a37861fdbdae72c9bdefa9"
integrity sha512-WJTeyp0JzGtHcuMsi7rw2VwtkvLa+JyfEKJCFyfcS0+CDkjQ5lHPu7zEhFZP+PDSRrEgXa5Ah0l1MbgbE41XjA==
has-ansi@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
@ -6123,6 +6128,13 @@ icss-utils@^4.0.0, icss-utils@^4.1.1:
dependencies:
postcss "^7.0.14"
identity-obj-proxy@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/identity-obj-proxy/-/identity-obj-proxy-3.0.0.tgz#94d2bda96084453ef36fbc5aaec37e0f79f1fc14"
integrity sha1-lNK9qWCERT7zb7xarsN+D3nx/BQ=
dependencies:
harmony-reflect "^1.4.6"
ieee754@^1.1.4:
version "1.1.13"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84"
@ -8116,6 +8128,11 @@ multimatch@^2.1.0:
arrify "^1.0.0"
minimatch "^3.0.0"
mutation-observer@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/mutation-observer/-/mutation-observer-1.0.3.tgz#42e9222b101bca82e5ba9d5a7acf4a14c0f263d0"
integrity sha512-M/O/4rF2h776hV7qGMZUH3utZLO/jK7p8rnNgGkjKUw8zCGjRQPxB8z6+5l8+VjRUQ3dNYu4vjqXYLr+U8ZVNA==
mute-stream@0.0.7:
version "0.0.7"
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"