Skip to content

Commit 423609c

Browse files
authored
Update actions, dependencies, etc (#433)
1 parent 352d059 commit 423609c

21 files changed

+1673
-2012
lines changed

.editorconfig

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22
root = true
33

44
[*]
5-
indent_style = tab
6-
indent_size = 4
5+
indent_style = space
6+
indent_size = 2
77
end_of_line = lf
88
charset = utf-8
99
trim_trailing_whitespace = true
1010
insert_final_newline = true
1111

12-
[gulpfile.js]
13-
indent_style = space
14-
indent_size = 2
15-
16-
[*.yml]
17-
indent_style = space
18-
indent_size = 2
12+
[*.html]
13+
indent_style = tab
14+
indent_size = 4

.eslintrc.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
extends:
32
- chartjs
43
- plugin:es/no-new-in-es2019
@@ -18,15 +17,4 @@ parserOptions:
1817
plugins: ['html', 'es']
1918

2019
rules:
21-
class-methods-use-this: "off"
2220
complexity: ["warn", 10]
23-
max-statements: ["warn", 30]
24-
no-empty-function: "off"
25-
no-use-before-define: ["error", { "functions": false }]
26-
# disable everything, except Rest/Spread Properties in ES2018
27-
es/no-async-iteration: "error"
28-
es/no-malformed-template-literals: "error"
29-
es/no-regexp-lookbehind-assertions: "error"
30-
es/no-regexp-named-capture-groups: "error"
31-
es/no-regexp-s-flag: "error"
32-
es/no-regexp-unicode-property-escapes: "error"

.github/workflows/ci.yml

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,49 @@ on:
77
- master
88

99
jobs:
10-
Tests:
10+
build:
11+
1112
runs-on: ${{ matrix.os }}
12-
timeout-minutes: 6
13+
1314
strategy:
1415
matrix:
15-
os: [ubuntu-latest]
16+
os: [ubuntu-latest, windows-latest]
1617
fail-fast: false
18+
1719
steps:
1820
- uses: actions/checkout@v2
1921
- name: Use Node.js
2022
uses: actions/setup-node@v1
21-
- name: Build and Test
22-
run: |
23+
- run: |
2324
npm ci
2425
npm run build
2526
if [ "${{ runner.os }}" == "Windows" ]; then
2627
npm test
27-
elif [ "${{ runner.os }}" == "macOS" ]; then
28-
npm test --browsers chrome,safari
2928
else
3029
xvfb-run --auto-servernum npm test
3130
fi
3231
shell: bash
32+
- name: Coveralls Parallel - Chrome
33+
uses: coverallsapp/github-action@master
34+
with:
35+
github-token: ${{ secrets.github_token }}
36+
path-to-lcov: './coverage/chrome/lcov.info'
37+
flag-name: ${{ matrix.os }}-chrome
38+
parallel: true
39+
- name: Coveralls Parallel - Firefox
40+
uses: coverallsapp/github-action@master
41+
with:
42+
github-token: ${{ secrets.github_token }}
43+
path-to-lcov: './coverage/firefox/lcov.info'
44+
flag-name: ${{ matrix.os }}-firefox
45+
parallel: true
46+
47+
finish:
48+
needs: build
49+
runs-on: ubuntu-latest
50+
steps:
51+
- name: Coveralls Finished
52+
uses: coverallsapp/github-action@master
53+
with:
54+
github-token: ${{ secrets.github_token }}
55+
parallel-finished: true

karma.conf.js

Lines changed: 105 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,125 +1,123 @@
1-
/* eslint-env es6 */
2-
31
const commonjs = require('rollup-plugin-commonjs');
42
const istanbul = require('rollup-plugin-istanbul');
53
const resolve = require('rollup-plugin-node-resolve');
64
const builds = require('./rollup.config');
5+
const yargs = require('yargs');
6+
const env = process.env.NODE_ENV;
77

88
module.exports = function(karma) {
9-
const args = karma.args || {};
9+
const args = yargs
10+
.option('verbose', {default: false})
11+
.argv;
12+
13+
// Use the same rollup config as our dist files: when debugging (--watch),
14+
// we will prefer the unminified build which is easier to browse and works
15+
// better with source mapping. In other cases, pick the minified build to
16+
// make sure that the minification process (terser) doesn't break anything.
17+
const regex = karma.autoWatch ? /\.js$/ : /\.min\.js$/;
18+
const build = builds.filter(v => v.output.file.match(regex))[0];
1019

11-
// Use the same rollup config as our dist files: when debugging (--watch),
12-
// we will prefer the unminified build which is easier to browse and works
13-
// better with source mapping. In other cases, pick the minified build to
14-
// make sure that the minification process (terser) doesn't break anything.
15-
const regex = args.watch ? /\.js$/ : /\.min\.js$/;
16-
const build = builds.filter(v => v.output.file.match(regex))[0];
20+
if (env === 'test') {
21+
build.plugins = [
22+
resolve(),
23+
istanbul({exclude: ['node_modules/**/*.js', 'package.json']})
24+
];
25+
}
1726

18-
if (args.watch) {
19-
build.output.sourcemap = 'inline';
20-
}
27+
karma.set({
28+
frameworks: ['jasmine'],
29+
reporters: ['spec', 'kjhtml'],
30+
browsers: (args.browsers || 'chrome,firefox').split(','),
31+
logLevel: karma.LOG_INFO,
2132

22-
karma.set({
23-
frameworks: ['jasmine'],
24-
reporters: ['spec', 'kjhtml'],
25-
browsers: ['chrome', 'firefox'],
26-
logLevel: karma.LOG_WARN,
33+
client: {
34+
jasmine: {
35+
failFast: !!karma.autoWatch
36+
}
37+
},
2738

28-
// Explicitly disable hardware acceleration to make image
29-
// diff more stable when ran on Travis and dev machine.
30-
// https://github.com/chartjs/Chart.js/pull/5629
31-
customLaunchers: {
32-
chrome: {
33-
base: 'Chrome',
34-
flags: [
35-
'--disable-accelerated-2d-canvas'
36-
]
37-
},
38-
firefox: {
39-
base: 'Firefox',
40-
prefs: {
41-
'layers.acceleration.disabled': true
42-
}
43-
}
44-
},
39+
// Explicitly disable hardware acceleration to make image
40+
// diff more stable when ran on Travis and dev machine.
41+
// https://github.com/chartjs/Chart.js/pull/5629
42+
customLaunchers: {
43+
chrome: {
44+
base: 'Chrome',
45+
flags: [
46+
'--disable-accelerated-2d-canvas'
47+
]
48+
},
49+
firefox: {
50+
base: 'Firefox',
51+
prefs: {
52+
'layers.acceleration.disabled': true
53+
}
54+
}
55+
},
4556

46-
files: [
47-
// {pattern: 'test/fixtures/**/*.js', included: false},
48-
// {pattern: 'test/fixtures/**/*.json', included: false},
49-
// {pattern: 'test/fixtures/**/*.png', included: false},
50-
{pattern: 'node_modules/chart.js/dist/chart.js'},
51-
{pattern: 'test/index.js'},
52-
{pattern: 'src/index.js'},
53-
{pattern: 'test/specs/**/*.js'}
54-
],
57+
files: [
58+
// {pattern: 'test/fixtures/**/*.js', included: false},
59+
// {pattern: 'test/fixtures/**/*.json', included: false},
60+
// {pattern: 'test/fixtures/**/*.png', included: false},
61+
{pattern: 'node_modules/chart.js/dist/chart.js'},
62+
{pattern: 'test/index.js'},
63+
{pattern: 'src/index.js'},
64+
{pattern: 'test/specs/**/*.js'}
65+
],
5566

56-
preprocessors: {
57-
// 'test/fixtures/**/*.js': ['fixtures'],
58-
'test/specs/**/*.js': ['rollup'],
59-
'test/index.js': ['rollup'],
60-
'src/index.js': ['sources']
61-
},
67+
preprocessors: {
68+
// 'test/fixtures/**/*.js': ['fixtures'],
69+
'test/specs/**/*.js': ['rollup'],
70+
'test/index.js': ['rollup'],
71+
'src/index.js': ['sources']
72+
},
6273

63-
rollupPreprocessor: {
64-
plugins: [
65-
resolve(),
66-
commonjs()
67-
],
68-
external: [
69-
'chart.js'
70-
],
71-
output: {
72-
format: 'umd',
73-
globals: {
74-
'chart.js': 'Chart'
75-
}
76-
}
77-
},
74+
rollupPreprocessor: {
75+
plugins: [
76+
resolve(),
77+
],
78+
external: [
79+
'chart.js'
80+
],
81+
output: {
82+
name: 'test',
83+
format: 'umd',
84+
globals: {
85+
'chart.js': 'Chart'
86+
}
87+
}
88+
},
7889

79-
customPreprocessors: {
80-
fixtures: {
81-
base: 'rollup',
82-
options: {
83-
output: {
84-
format: 'iife',
85-
name: 'fixture'
86-
}
87-
}
88-
},
89-
sources: {
90-
base: 'rollup',
91-
options: build
92-
}
93-
},
90+
customPreprocessors: {
91+
fixtures: {
92+
base: 'rollup',
93+
options: {
94+
output: {
95+
format: 'iife',
96+
name: 'fixture'
97+
}
98+
}
99+
},
100+
sources: {
101+
base: 'rollup',
102+
options: build
103+
}
104+
},
94105

95-
// These settings deal with browser disconnects. We had seen test flakiness from Firefox
96-
// [Firefox 56.0.0 (Linux 0.0.0)]: Disconnected (1 times), because no message in 10000 ms.
97-
// https://github.com/jasmine/jasmine/issues/1327#issuecomment-332939551
98-
browserDisconnectTolerance: 3
99-
});
106+
// These settings deal with browser disconnects. We had seen test flakiness from Firefox
107+
// [Firefox 56.0.0 (Linux 0.0.0)]: Disconnected (1 times), because no message in 10000 ms.
108+
// https://github.com/jasmine/jasmine/issues/1327#issuecomment-332939551
109+
browserDisconnectTolerance: 3
110+
});
100111

101-
// https://swizec.com/blog/how-to-run-javascript-tests-in-chrome-on-travis/swizec/6647
102-
if (process.env.TRAVIS) {
103-
karma.customLaunchers.chrome.flags.push('--no-sandbox');
104-
}
105112

106-
if (args.coverage) {
107-
karma.reporters.push('coverage');
108-
karma.coverageReporter = {
109-
dir: 'coverage/',
110-
reporters: [
111-
{type: 'html', subdir: 'html'},
112-
{type: 'lcovonly', subdir: '.'}
113-
]
114-
};
115-
[
116-
karma.rollupPreprocessor,
117-
karma.customPreprocessors.sources.options
118-
].forEach(v => {
119-
(v.plugins || (v.plugins = [])).unshift(
120-
istanbul({
121-
include: 'src/**/*.js'
122-
}));
123-
});
124-
}
113+
if (env === 'test') {
114+
karma.reporters.push('coverage');
115+
karma.coverageReporter = {
116+
dir: 'coverage/',
117+
reporters: [
118+
{type: 'html', subdir: 'html'},
119+
{type: 'lcovonly', subdir: (browser) => browser.toLowerCase().split(/[ /-]/)[0]}
120+
]
121+
};
122+
}
125123
};

0 commit comments

Comments
 (0)