8000 Merge branch 'master' into image-clip-path · plotly/plotly.js@521015a · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 521015a

Browse files
committed
Merge branch 'master' into image-clip-path
2 parents 10fe521 + 10dd54a commit 521015a

19 files changed

+117
-150
lines changed

circle.yml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
general:
22
artifacts:
3-
- "build/test_images/"
4-
- "build/test_images_diff/"
3+
- build/test_images/
4+
- build/test_images_diff/
55

66
machine:
77
node:
@@ -12,21 +12,16 @@ machine:
1212
- docker
1313

1414
dependencies:
15-
pre:
16-
- eval $(node tasks/docker.js pull)
17-
post:
18-
- eval $(node tasks/docker.js run)
19-
- npm run cibuild
15+
override:
16+
- npm install && npm dedupe && npm prune && npm install
17+
- npm ls || true
18+
- npm run docker -- pull
2019
- npm run pretest
21-
- eval $(node tasks/docker.js setup)
22-
- npm prune && npm ls
20+
- npm run docker -- run
21+
- npm run cibuild
22+
- npm run docker -- setup
2323

2424
test:
2525
override:
26-
- npm run test-image
27-
- npm run test-image-gl2d
28-
- npm run test-export
29-
- npm run citest-jasmine
30-
- npm run test-bundle
31-
- npm run test-syntax
32-
- eslint .
26+
- ./tasks/ci_test.sh:
27+
parallel: true

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
"build": "npm run preprocess && npm run bundle && npm run header && npm run stats",
2929
"cibuild": "npm run preprocess && node tasks/cibundle.js",
3030
"watch": "node tasks/watch.js",
31-
"lint": "eslint --version && eslint . || true",
32-
"lint-fix": "eslint . --fix",
31+
"lint": "eslint --version && eslint .",
32+
"lint-fix": "eslint . --fix || true",
3333
"docker": "node tasks/docker.js",
3434
"pretest": "node tasks/pretest.js",
3535
"test-jasmine": "karma start test/jasmine/karma.conf.js",
36-
"citest-jasmine": "karma start test/jasmine/karma.ciconf.js",
36+
"citest-jasmine": "CIRCLECI=1 karma start test/jasmine/karma.conf.js",
3737
"test-image": "node tasks/test_image.js",
3838
"test-image-gl2d": "node tasks/test_image.js gl2d_* --queue",
3939
"test-export": "node tasks/test_export.js",
@@ -119,6 +119,9 @@
119119
"karma-coverage": "^1.0.0",
120120
"karma-firefox-launcher": "^1.0.0",
121121
"karma-jasmine": "^1.1.0",
122+
"karma-jasmine-spec-tags": "^1.0.1",
123+
"karma-spec-reporter": "0.0.30",
124+
"karma-verbose-reporter": "0.0.6",
122125
"madge": "^1.6.0",
123126
"node-sass": "^4.5.0",
124127
"npm-link-check": "^1.2.0",
@@ -128,7 +131,7 @@
128131
"read-last-lines": "^1.1.0",
129132
"requirejs": "^2.3.1",
130133
"through2": "^2.0.3",
131-
"uglify-js": "^2.7.5",
134+
"uglify-js": "~2.7.5",
132135
"watchify": "^3.9.0",
133136
"xml2js": "^0.4.16"
134137
}

tasks/ci_test.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
EXIT_STATE=0
4+
5+
case $CIRCLE_NODE_INDEX in
6+
7+
0)
8+
npm run test-image || EXIT_STATE=$?
9+
npm run test-image-gl2d || EXIT_STATE=$?
10+
npm run test-export || EXIT_STATE=$?
11+
npm run test-syntax || EXIT_STATE=$?
12+
npm run lint || EXIT_STATE=$?
13+
exit $EXIT_STATE
14+
;;
15+
16+
1)
17+
npm run test-jasmine || EXIT_STATE=$?
18+
npm run test-bundle || EXIT_STATE=$?
19+
exit $EXIT_STATE
20+
;;
21+
22+
esac

tasks/docker.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,5 @@ switch(arg) {
4646
break;
4747
}
4848

49-
// Log command string on CircleCI, to then `eval` them,
50-
// which appears to be more reliable then calling `child_process.exec()`
51-
if(isCI) {
52-
console.log(cmd);
53-
}
54-
else {
55-
console.log(msg);
56-
common.execCmd(cmd, cb, errorCb);
57-
}
49+
console.log(msg);
50+
common.execCmd(cmd, cb, errorCb);

tasks/noci_test.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#! /bin/bash
2+
3+
EXIT_STATE=0
4+
5+
# tests that aren't run on CI
6+
7+
# jasmine specs with @noCI tag
8+
npm run citest-jasmine -- tests/*_test.js --tags noCI || EXIT_STATE=$?
9+
10+
# mapbox image tests take too much resources on CI
11+
npm run test-image -- mapbox_* || EXIT_STATE=$?
12+
13+
# run gl2d image test again (some mocks are skipped on CI)
14+
npm run test-image-gl2d || EXIT_STATE=$?
15+
16+
exit $EXIT_STATE

tasks/test_export.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ var cmd = containerCommands.getRunCmd(
1414
);
1515

1616
console.log(msg);
17-
common.execCmd(cmd);
17+
common.execCmd(containerCommands.ping, function() {
18+
common.execCmd(cmd);
19+
});

tasks/test_image.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ var cmd = containerCommands.getRunCmd(
1414
);
1515

1616
console.log(msg);
17-
common.execCmd(cmd);
17+
common.execCmd(containerCommands.ping, function() {
18+
common.execCmd(cmd);
19+
});

tasks/util/container_commands.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ containerCommands.setup = [
2222
containerCommands.injectEnv,
2323
containerCommands.restart,
2424
'sleep 1',
25-
containerCommands.ping,
26-
'echo '
2725
].join(' && ');
2826

2927
containerCommands.dockerRun = [

test/jasmine/assets/has_webgl_support.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

test/jasmine/karma.ciconf.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

test/jasmine/karma.conf.js

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var constants = require('../../tasks/util/constants');
1717

1818
var arg = process.argv[4];
1919

20+
var isCI = !!process.env.CIRCLECI;
2021
var testFileGlob = arg ? arg : 'tests/*_test.js';
2122
var isSingleSuiteRun = (arg && arg.indexOf('bundle_tests/') === -1);
2223
var isRequireJSTest = (arg && arg.indexOf('bundle_tests/requirejs') !== -1);
@@ -53,13 +54,14 @@ func.defaultConfig = {
5354

5455
// frameworks to use
5556
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
56-
frameworks: ['jasmine', 'browserify'],
57+
frameworks: ['jasmine', 'jasmine-spec-tags', 'browserify'],
5758

5859
// list of files / patterns to load in the browser
5960
//
6061
// N.B. this field is filled below
6162
files: [],
6263

64+
// list of files / pattern to exclude
6365
exclude: [],
6466

6567
// preprocess matching files before serving them to the browser
@@ -75,7 +77,7 @@ func.defaultConfig = {
7577
// See note in CONTRIBUTING.md about more verbose reporting via karma-verbose-reporter:
7678
// https://www.npmjs.com/package/karma-verbose-reporter ('verbose')
7779
//
78-
reporters: ['progress'],
80+
reporters: isSingleSuiteRun ? ['progress'] : ['dots', 'spec'],
7981

8082
// web server port
8183
port: 9876,
@@ -84,14 +86,23 @@ func.defaultConfig = {
8486
colors: true,
8587

8688
// enable / disable watching file and executing tests whenever any file changes
87-
autoWatch: true,
89+
autoWatch: !isCI,
90+
91+
// if true, Karma captures browsers, runs the tests and exits
92+
singleRun: isCI,
93+
94+
// how long will Karma wait for a message from a browser before disconnecting (30 ms)
95+
browserNoActivityTimeout: 30000,
8896

8997
// start these browsers
9098
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
9199
browsers: ['Chrome_WindowSized'],
92100

93101
// custom browser options
102+
//
94103
// window-size values came from observing default size
104+
//
105+
// '--ignore-gpu-blacklist' allow to test WebGL on CI (!!!)
95106
customLaunchers: {
96107
Chrome_WindowSized: {
97108
base: 'Chrome',
@@ -103,58 +114,64 @@ func.defaultConfig = {
103114
}
104115
},
105116

106-
// Continuous Integration mode
107-
// if true, Karma captures browsers, runs the tests and exits
108-
singleRun: false,
109-
110117
browserify: {
111118
transform: ['../../tasks/util/shortcut_paths.js'],
112119
extensions: ['.js'],
113-
watch: true,
120+
watch: !isCI,
114121
debug: true
122+
},
123+
124+
// unfortunately a few tests don't behave well on CI
125+
// using `karma-jasmine-spec-tags`
126+
// add @noCI to the spec description to skip a spec on CI
127+
client: {
128+
tagPrefix: '@',
129+
skipTags: isCI ? 'noCI' : null
130+
},
131+
132+
// use 'karma-spec-reporter' to log info about skipped specs
133+
specReporter: {
134+
suppressErrorSummary: true,
135+
suppressFailed: true,
136+
suppressPassed: true,
137+
suppressSkipped: false,
138+
showSpecTiming: false,
139+
failFast: false
115140
}
116141
};
117142

118-
119143
// Add lib/index.js to single-suite runs,
120144
// to avoid import conflicts due to plotly.js
121145
// circular dependencies.
122146
if(isSingleSuiteRun) {
123-
func.defaultConfig.files = [
147+
func.defaultConfig.files.push(
124148
pathToJQuery,
125-
pathToMain,
126-
testFileGlob
127-
];
149+
pathToMain
150+
);
128151

129152
func.defaultConfig.preprocessors[pathToMain] = ['browserify'];
130153
func.defaultConfig.preprocessors[testFileGlob] = ['browserify'];
131154
}
132155
else if(isRequireJSTest) {
133156
func.defaultConfig.files = [
134157
constants.pathToRequireJS,
135-
constants.pathToRequireJSFixture,
136-
testFileGlob
158+
constants.pathToRequireJSFixture
137159
];
138160
}
139161
else if(isIE9Test) {
140162
// load ie9_mock.js before plotly.js+test bundle
141163
// to catch reference errors that could occur
142164
// when plotly.js is first loaded.
143165

144-
func.defaultConfig.files = [
145-
'./assets/ie9_mock.js',
146-
testFileGlob
147-
];
148-
166+
func.defaultConfig.files.push('./assets/ie9_mock.js');
149167
func.defaultConfig.preprocessors[testFileGlob] = ['browserify'];
150168
}
151169
else {
152-
func.defaultConfig.files = [
153-
pathToJQuery,
154-
testFileGlob
155-
];
156-
170+
func.defaultConfig.files.push(pathToJQuery);
157171
func.defaultConfig.preprocessors[testFileGlob] = ['browserify'];
158172
}
159173

174+
// lastly, load test file glob
175+
func.defaultConfig.files.push(testFileGlob);
176+
160177
module.exports = func;

test/jasmine/tests/annotations_test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,23 +514,26 @@ describe('annotations autorange', function() {
514514

515515
function assertRanges(x, y, x2, y2, x3, y3) {
516516
var fullLayout = gd._fullLayout;
517-
var PREC = 1;
518517

518+
var PREC = 1;
519519
// xaxis2 need a bit more tolerance to pass on CI
520520
// this most likely due to the different text bounding box values
521521
// on headfull vs headless browsers.
522522
// but also because it's a date axis that we've converted to ms
523523
var PRECX2 = -10;
524524
// yaxis2 needs a bit more now too...
525525
var PRECY2 = 0.2;
526+
// and xaxis3 too...
527+
var PRECX3 = 0.2;
528+
526529
var dateAx = fullLayout.xaxis2;
527530

528531
expect(fullLayout.xaxis.range).toBeCloseToArray(x, PREC, '- xaxis');
529532
expect(fullLayout.yaxis.range).toBeCloseToArray(y, PREC, '- yaxis');
530533
expect(Lib.simpleMap(dateAx.range, dateAx.r2l))
531534
.toBeCloseToArray(Lib.simpleMap(x2, dateAx.r2l), PRECX2, 'xaxis2 ' + dateAx.range);
532535
expect(fullLayout.yaxis2.range).toBeCloseToArray(y2, PRECY2, 'yaxis2');
533-
expect(fullLayout.xaxis3.range).toBeCloseToArray(x3, PREC, 'xaxis3');
536+
expect(fullLayout.xaxis3.range).toBeCloseToArray(x3, PRECX3, 'xaxis3');
534537
expect(fullLayout.yaxis3.range).toBeCloseToArray(y3, PREC, 'yaxis3');
535538
}
536539

0 commit comments

Comments
 (0)
0