Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest #2

Merged
merged 6 commits into from
Dec 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 92 additions & 87 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,87 +1,92 @@
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*

# Org-mode
.org-id-locations
*_archive

# flymake-mode
*_flymake.*

# eshell files
/eshell/history
/eshell/lastdir

# elpa packages
/elpa/

# reftex files
*.rel

# AUCTeX auto folder
/auto/

# cask packages
.cask/
dist/

# Flycheck
flycheck_*.el

# server auth directory
/server/

# projectiles files
.projectile

# directory configuration
.dir-locals.el

# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

build
CMakeCache.txt
CMakeFiles
cmake_install.cmake
compile_commands.json
node_modules
*.mem
ftpsync.settings
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*

# Org-mode
.org-id-locations
*_archive

# flymake-mode
*_flymake.*

# eshell files
/eshell/history
/eshell/lastdir

# elpa packages
/elpa/

# reftex files
*.rel

# AUCTeX auto folder
/auto/

# cask packages
.cask/
dist/

# Flycheck
flycheck_*.el

# server auth directory
/server/

# projectiles files
.projectile

# directory configuration
.dir-locals.el

# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

build
CMakeCache.txt
CMakeFiles
cmake_install.cmake
compile_commands.json
node_modules
*.mem
ftpsync.settings
*.log
*.png
Gemfile
Gemfile.lock
Vagrantfile
28 changes: 22 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@

dist: trusty

language: node_js

node_js:
- "7"
- "8"

env:
global:
- EM_USE_GLOBAL_CACHE=1
- CACHE_DIR=$HOME/.cache/docker
- CACHE_FILE_EMSCRIPTEN=$CACHE_DIR/emscripten.tar.gz
- CACHE_FILE_PUPPETEER=$CACHE_DIR/puppeteer.tar.gz

addons:
apt:
Expand All @@ -18,13 +23,24 @@ sudo: required
services:
- docker

cache:
directories:
- $CACHE_DIR

before_install:
- mkdir boost_includes
- cp -r /usr/include/boost boost_includes/
- if [ -f ${CACHE_FILE_EMSCRIPTEN} ]; then gunzip -c ${CACHE_FILE_EMSCRIPTEN} | docker load; fi
- if [ -f ${CACHE_FILE_PUPPETEER} ]; then gunzip -c ${CACHE_FILE_PUPPETEER} | docker load; fi
- docker run -dit --name emscripten -v $(pwd):/src trzeci/emscripten:sdk-incoming-64bit bash

script:
install:
- npm install
- mkdir boost_includes
- cp -r /usr/include/boost boost_includes/
- ./node_modules/.bin/lerna bootstrap --hoist

script:
- docker exec -it emscripten ./node_modules/.bin/lerna run start --stream
- ./node_modules/.bin/lerna run test
- npm test

after_script:
- if [ ! -f ${CACHE_FILE_EMSCRIPTEN} ]; then docker save trzeci/emscripten:sdk-incoming-64bit | gzip > ${CACHE_FILE_EMSCRIPTEN}; fi
- if [ ! -f ${CACHE_FILE_PUPPETEER} ]; then docker save zenato/puppeteer | gzip > ${CACHE_FILE_PUPPETEER}; fi
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"devDependencies": {
"lerna": "^2.5.1"
},
"scripts": {
"start": "lerna run start",
"postinstall": "lerna bootstrap --hoist",
"test": "docker run -it --rm -u root -v $(pwd):/src -w /src zenato/puppeteer ./node_modules/.bin/lerna run test",
"write_tests": "docker run -it --rm -u root -e WRITE_TESTS=1 -v $(pwd):/src -w /src zenato/puppeteer ./node_modules/.bin/lerna run test"
}
}
14 changes: 11 additions & 3 deletions packages/perspective-viewer-highcharts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@
],
"scripts": {
"highcharts": "webpack --config src/config/highcharts.plugin.config.js",
"start": "npm run highcharts",
"start": "npm run highcharts && npm run compile_test",
"compile_test": "cp test/html/* build",
"test": "jest 2>&1",
"clean": "find build -mindepth 1 -delete"
},
"jest": {
"roots": ["test/js"],
"verbose": true
},
"publishConfig": {
"access": "public"
},
Expand All @@ -30,10 +36,12 @@
"highcharts": "5.0.14",
"highcharts-grouped-categories": "1.1.2",
"highcharts-more": "^0.1.2",
"highcharts-heatmap": "^0.1.2",
"@jpmorganchase/perspective-common": "^0.0.0"
"highcharts-heatmap": "^0.1.2"
},
"devDependencies": {
"@jpmorganchase/perspective": "^0.0.0",
"@jpmorganchase/perspective-viewer": "^0.0.0",
"@jpmorganchase/perspective-common": "^0.0.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-polyfill": "^6.26.0",
Expand Down
10 changes: 1 addition & 9 deletions packages/perspective-viewer-highcharts/src/js/highcharts.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,6 @@ export function draw(mode) {
var col_pivots = this._view_columns('#column_pivots perspective-row:not(.off)');
var aggregates = this._get_view_aggregates();

var t = performance.now();

let [js, schema] = await Promise.all([view.to_json(), view.schema()]);

let [series, top, colorRange] = _make_series.call(this, js, row_pivots, col_pivots, mode, hidden);
Expand Down Expand Up @@ -484,17 +482,11 @@ export function draw(mode) {
for (let e of Array.prototype.slice.call(el.children)) { el.removeChild(e); }
el.appendChild(this._chart.renderTo);
}

if (!this.hasAttribute('render_time')) {
this.dispatchEvent(new Event('loaded', {bubbles: true}));
}

this.setAttribute('render_time', performance.now() - t);
};
}

function resize(immediate) {
if (immediate) {
if (immediate && this._chart) {
this._chart.reflow();
} else {
if (this.resize_timer) {
Expand Down
39 changes: 39 additions & 0 deletions packages/perspective-viewer-highcharts/test/html/superstore.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--

Copyright (c) 2017, the Perspective Authors.

This file is part of the Perspective library, distributed under the terms of
the Apache License 2.0. The full license can be found in the LICENSE file.

-->

<!DOCTYPE html>
<html>
<head>

<script src="perspective.view.js"></script>
<script src="highcharts.plugin.js"></script>

<link rel='stylesheet' href="demo.css">

</head>
<body>

<perspective-viewer
columns='["Sales"]'>

</perspective-viewer>

<script>

var xhr = new XMLHttpRequest();
xhr.open('GET', 'superstore.csv', true);
xhr.onload = function () {
document.getElementsByTagName('perspective-viewer')[0].load(xhr.response);
}
xhr.send(null);

</script>

</body>
</html>
10 changes: 10 additions & 0 deletions packages/perspective-viewer-highcharts/test/js/superstore.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/******************************************************************************
*
* Copyright (c) 2017, the Perspective Authors.
*
* This file is part of the Perspective library, distributed under the terms of
* the Apache License 2.0. The full license can be found in the LICENSE file.
*
*/

require('@jpmorganchase/perspective-viewer/test/js/superstore.spec.js');
10 changes: 10 additions & 0 deletions packages/perspective-viewer-highcharts/test/results/results.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"shows a grid without any settings applied.": "9880a0fc261c00dc0a210eeeba7d06f6",
"pivots by a row.": "4711f455d5c9d5d3bc8c177b92da725f",
"pivots by two rows.": "53f0c27ba47a5df2974c30289fe02a78",
"pivots by a row and a column.": "8546e4942f755673794abce6d584b6b6",
"pivots by two rows and two columns.": "ff17b69cef7bfc90ec21b56729a4256f",
"sorts by a numeric column.": "375062fbd50e09afa7b6df7e6b4a3a5f",
"sorts by an alpha column.": "2643e0b5787b6e8e85f122b1713d01cd",
"displays visible columns.": "1da296527f149393be8f3f99e34b3e4a"
}
Loading