Skip to content

Commit

Permalink
Fix tests and improve CI (#590)
Browse files Browse the repository at this point in the history
* Fix tests and improve CI

* Add xvfb to Linux - still problems with Mocha e2e tests

* Disable Webpack Bundle Analyzer for testing

* Use preinstalled yarn application on AppVeyor

* Fix build failure with latest vue version

* Remove "markdown-toc"

* Fix application title unit test

* Hide electron window during unit tests

* Add basic muya unit tests

* Dirty markdown-toc replacement

* Update dependencies

* Update eslint packages and configuration
  • Loading branch information
fxha authored and Jocs committed Dec 17, 2018
1 parent fa394be commit 2ce0582
Show file tree
Hide file tree
Showing 35 changed files with 2,226 additions and 4,818 deletions.
7 changes: 6 additions & 1 deletion .electron-vue/webpack.renderer.config.js
Expand Up @@ -172,13 +172,18 @@ const rendererConfig = {
*/
if (process.env.NODE_ENV !== 'production') {
rendererConfig.plugins.push(
new BundleAnalyzerPlugin(),
new webpack.DefinePlugin({
'__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
})
)
}

if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test') {
rendererConfig.plugins.push(
new BundleAnalyzerPlugin()
)
}

/**
* Adjust rendererConfig for production settings
*/
Expand Down
17 changes: 14 additions & 3 deletions .eslintrc.js
Expand Up @@ -2,24 +2,35 @@ module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
ecmaFeatures: {
impliedStrict: true
},
sourceType: 'module'
},
env: {
browser: true,
es6: true,
node: true
},
extends: 'standard',
extends: [
'standard',
'eslint:recommended',
'plugin:vue/base' // 'plugin:vue/essential'
],
globals: {
__static: true
},
plugins: [
'html'
'html',
'vue'
],
'rules': {
rules: {
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
'generator-star-spacing': 0,
// allow console
'no-console': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
}
Expand Down
32 changes: 12 additions & 20 deletions .travis.yml
@@ -1,20 +1,17 @@
# Commented sections below can be used to run tests on the CI server
# https://simulatedgreg.gitbooks.io/electron-vue/content/en/testing.html#on-the-subject-of-ci-testing
osx_image: xcode9.2
sudo: required
dist: trusty

language: node_js
node_js:
- 8

matrix:
include:
- os: osx
env: CC=clang CXX=clang++ npm_config_clang=1 MARKTEXT_IS_OFFICIAL_RELEASE=1
osx_image: xcode9.2
env: CC=clang CXX=clang++ npm_config_clang=1 MARKTEXT_IS_OFFICIAL_RELEASE=1 MARKTEXT_EXIT_ON_ERROR=1
compiler: clang
- os: linux
env: CC=clang CXX=clang++ npm_config_clang=1 MARKTEXT_IS_OFFICIAL_RELEASE=1
dist: trusty
env: CC=clang CXX=clang++ npm_config_clang=1 MARKTEXT_IS_OFFICIAL_RELEASE=1 MARKTEXT_EXIT_ON_ERROR=1 DISPLAY=:99.0
compiler: clang

cache:
Expand All @@ -30,28 +27,19 @@ addons:
- icnsutils
- graphicsmagick
- xz-utils
#- xvfb
- xvfb
# atom/keyboard-layout
- libx11-dev
- libxkbfile-dev

before_install:
#- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get -qq update ; fi
#- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
# wget -qO - https://dl.winehq.org/wine-builds/Release.key | sudo apt-key add -;
# sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/;
# fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get -qq update ; fi
#- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install --install-recommends winehq-stable ; fi

#- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi

install:
#- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export DISPLAY=':99.0' ; fi
#- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & ; fi
- curl -o- -L https://yarnpkg.com/install.sh | bash
- source ~/.bashrc
- npm install -g xvfb-maybe

- $CC --version
- $CXX --version
Expand All @@ -61,13 +49,17 @@ install:
- yarn

script:
#- xvfb-maybe node_modules/.bin/karma start test/unit/karma.conf.js
#- yarn run pack && xvfb-maybe node_modules/.bin/mocha test/e2e
- yarn run lint

# Unit and e2e tests
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then xvfb-run --server-args="-screen 0 1024x768x24" yarn run test ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then yarn run test ; fi

# Build binaries
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then yarn run release:linux ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then yarn run release:mac ; fi

# calculate checksums
# Calculate checksums
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sha256sum build/marktext-*-x64.tar.gz ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sha256sum build/marktext-*-x86_64.AppImage ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then shasum -a 256 build/Mark\ Text-*-mac.zip ; fi
Expand Down
6 changes: 4 additions & 2 deletions appveyor.yml
Expand Up @@ -14,6 +14,7 @@ skip_tags: true

environment:
MARKTEXT_IS_OFFICIAL_RELEASE: 1
MARKTEXT_EXIT_ON_ERROR: 1
GH_TOKEN:
secure: Ki5AJWygDYhzMJxl0b0rDx3bhAYmar2aPdwVHiai9IigqsvZpWHLeI3qpTiiaOWL

Expand All @@ -22,7 +23,6 @@ init:

install:
- ps: Install-Product node 8 $env:PLATFORM
- choco install yarn --ignore-dependencies

- node --version
- npm --version
Expand All @@ -38,6 +38,8 @@ cache:

build_script:
- yarn run lint
- yarn run test

- yarn run release:win

# calculate checksums
Expand All @@ -46,4 +48,4 @@ build_script:

test: off
# test_script:
# - yarn test
# - yarn run test

0 comments on commit 2ce0582

Please sign in to comment.