Skip to content

Commit 2ce0582

Browse files
fxhaJocs
authored andcommitted
Fix tests and improve CI (marktext#590)
* 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
1 parent fa394be commit 2ce0582

35 files changed

+2226
-4818
lines changed

.electron-vue/webpack.renderer.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,18 @@ const rendererConfig = {
172172
*/
173173
if (process.env.NODE_ENV !== 'production') {
174174
rendererConfig.plugins.push(
175-
new BundleAnalyzerPlugin(),
176175
new webpack.DefinePlugin({
177176
'__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
178177
})
179178
)
180179
}
181180

181+
if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test') {
182+
rendererConfig.plugins.push(
183+
new BundleAnalyzerPlugin()
184+
)
185+
}
186+
182187
/**
183188
* Adjust rendererConfig for production settings
184189
*/

.eslintrc.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,35 @@ module.exports = {
22
root: true,
33
parser: 'babel-eslint',
44
parserOptions: {
5+
ecmaFeatures: {
6+
impliedStrict: true
7+
},
58
sourceType: 'module'
69
},
710
env: {
811
browser: true,
12+
es6: true,
913
node: true
1014
},
11-
extends: 'standard',
15+
extends: [
16+
'standard',
17+
'eslint:recommended',
18+
'plugin:vue/base' // 'plugin:vue/essential'
19+
],
1220
globals: {
1321
__static: true
1422
},
1523
plugins: [
16-
'html'
24+
'html',
25+
'vue'
1726
],
18-
'rules': {
27+
rules: {
1928
// allow paren-less arrow functions
2029
'arrow-parens': 0,
2130
// allow async-await
2231
'generator-star-spacing': 0,
32+
// allow console
33+
'no-console': 0,
2334
// allow debugger during development
2435
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
2536
}

.travis.yml

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
1-
# Commented sections below can be used to run tests on the CI server
2-
# https://simulatedgreg.gitbooks.io/electron-vue/content/en/testing.html#on-the-subject-of-ci-testing
3-
osx_image: xcode9.2
41
sudo: required
5-
dist: trusty
6-
72
language: node_js
83
node_js:
94
- 8
105

116
matrix:
127
include:
138
- os: osx
14-
env: CC=clang CXX=clang++ npm_config_clang=1 MARKTEXT_IS_OFFICIAL_RELEASE=1
9+
osx_image: xcode9.2
10+
env: CC=clang CXX=clang++ npm_config_clang=1 MARKTEXT_IS_OFFICIAL_RELEASE=1 MARKTEXT_EXIT_ON_ERROR=1
1511
compiler: clang
1612
- os: linux
17-
env: CC=clang CXX=clang++ npm_config_clang=1 MARKTEXT_IS_OFFICIAL_RELEASE=1
13+
dist: trusty
14+
env: CC=clang CXX=clang++ npm_config_clang=1 MARKTEXT_IS_OFFICIAL_RELEASE=1 MARKTEXT_EXIT_ON_ERROR=1 DISPLAY=:99.0
1815
compiler: clang
1916

2017
cache:
@@ -30,28 +27,19 @@ addons:
3027
- icnsutils
3128
- graphicsmagick
3229
- xz-utils
33-
#- xvfb
30+
- xvfb
3431
# atom/keyboard-layout
3532
- libx11-dev
3633
- libxkbfile-dev
3734

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

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

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

5644
- $CC --version
5745
- $CXX --version
@@ -61,13 +49,17 @@ install:
6149
- yarn
6250

6351
script:
64-
#- xvfb-maybe node_modules/.bin/karma start test/unit/karma.conf.js
65-
#- yarn run pack && xvfb-maybe node_modules/.bin/mocha test/e2e
6652
- yarn run lint
53+
54+
# Unit and e2e tests
55+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then xvfb-run --server-args="-screen 0 1024x768x24" yarn run test ; fi
56+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then yarn run test ; fi
57+
58+
# Build binaries
6759
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then yarn run release:linux ; fi
6860
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then yarn run release:mac ; fi
6961

70-
# calculate checksums
62+
# Calculate checksums
7163
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sha256sum build/marktext-*-x64.tar.gz ; fi
7264
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sha256sum build/marktext-*-x86_64.AppImage ; fi
7365
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then shasum -a 256 build/Mark\ Text-*-mac.zip ; fi

appveyor.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ skip_tags: true
1414

1515
environment:
1616
MARKTEXT_IS_OFFICIAL_RELEASE: 1
17+
MARKTEXT_EXIT_ON_ERROR: 1
1718
GH_TOKEN:
1819
secure: Ki5AJWygDYhzMJxl0b0rDx3bhAYmar2aPdwVHiai9IigqsvZpWHLeI3qpTiiaOWL
1920

@@ -22,7 +23,6 @@ init:
2223

2324
install:
2425
- ps: Install-Product node 8 $env:PLATFORM
25-
- choco install yarn --ignore-dependencies
2626

2727
- node --version
2828
- npm --version
@@ -38,6 +38,8 @@ cache:
3838

3939
build_script:
4040
- yarn run lint
41+
- yarn run test
42+
4143
- yarn run release:win
4244

4345
# calculate checksums
@@ -46,4 +48,4 @@ build_script:
4648

4749
test: off
4850
# test_script:
49-
# - yarn test
51+
# - yarn run test

0 commit comments

Comments
 (0)