Skip to content

Commit d30a6ac

Browse files
authored
Merge pull request #920 from finos/cov-js
Adds test coverage reporting for`@finos/perspective`
2 parents ed38f93 + 28b3e9f commit d30a6ac

File tree

15 files changed

+923
-633
lines changed

15 files changed

+923
-633
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,6 @@ docs/static/js/logo.js.map
161161
python/perspective/pip-wheel-metadata
162162
darwin.json
163163
darwin.interactive.json
164+
junit.xml
165+
python/perspective/python_junit.xml
166+
python/perspective/coverage.xml

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
[![Build Status](https://dev.azure.com/finosfoundation/perspective/_apis/build/status/finos.perspective?branchName=master)](https://dev.azure.com/finosfoundation/perspective/_build/latest?definitionId=1&branchName=master)
44
[![npm](https://img.shields.io/npm/v/@finos/perspective.svg?style=flat-square)](https://www.npmjs.com/package/@finos/perspective)
55
[![PyPI](https://img.shields.io/pypi/v/perspective-python.svg)](https://pypi.python.org/pypi/perspective-python)
6-
[![FINOS - Operating](https://cdn.rawgit.com/finos/contrib-toolbox/master/images/badge-operating.svg)](https://finosfoundation.atlassian.net/wiki/display/FINOS/Operating)
7-
86

97
A streaming data visualization engine for Javascript, Perspective makes it
108
simple to build real-time & user configurable analytics entirely in the browser.

azure-pipelines.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
jobs:
3-
- job: 'LinuxJS'
3+
- job: 'WebAssembly'
44
pool:
55
vmImage: 'ubuntu-16.04'
66

@@ -33,7 +33,6 @@ jobs:
3333
testRunner: JUnit
3434
testResultsFiles: 'junit.xml'
3535

36-
3736
- job: 'Linux'
3837
pool:
3938
vmImage: 'ubuntu-16.04'

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"@typescript-eslint/parser": "^2.4.0",
3434
"arraybuffer-loader": "^1.0.2",
3535
"babel-eslint": "^10.0.3",
36-
"babel-jest": "^24.5.0",
36+
"babel-jest": "^25.1.0",
3737
"babel-plugin-lodash": "^3.3.4",
3838
"babel-plugin-transform-custom-element-classes": "^0.1.0",
3939
"babel-polyfill": "^6.26.0",
@@ -56,7 +56,7 @@
5656
"html-loader": "^0.5.1",
5757
"html-loader-jest": "^0.2.1",
5858
"inquirer": "^7.0.0",
59-
"jest": "^24.5.0",
59+
"jest": "^25.1.0",
6060
"jest-junit": "^10.0.0",
6161
"js-beautify": "^1.8.6",
6262
"jsdoc": "3.5.5",
@@ -77,14 +77,15 @@
7777
"source-map-explorer": "^2.0.1",
7878
"style-loader": "^0.18.2",
7979
"term-img": "^4.1.0",
80-
"ts-jest": "^24.1.0",
80+
"ts-jest": "^25.1.0",
8181
"ts-loader": "^6.2.0",
8282
"typescript": "^3.7.4",
8383
"webpack": "^4.31.0",
8484
"webpack-cli": "^3.3.2",
8585
"webpack-fix-style-only-entries": "^0.4.0"
8686
},
8787
"resolutions": {
88+
"**/jest": "^25.1.0",
8889
"**/write-file-atomic": "2.4.1",
8990
"**/webpack": "^4.31.0",
9091
"**/webpack-cli": "^3.3.2",

packages/perspective-test/jest.all.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ module.exports = {
1414
".js$": "@finos/perspective-test/src/js/transform.js",
1515
".html$": "html-loader-jest"
1616
},
17+
collectCoverage: true,
18+
collectCoverageFrom: ["packages/perspective/dist/cjs/**"],
19+
coverageProvider: "v8",
20+
coverageReporters: ["cobertura", "text"],
1721
transformIgnorePatterns: ["/node_modules/(?!lit-html).+$"],
1822
automock: false,
1923
setupFiles: ["@finos/perspective-test/src/js/beforeEachSpec.js"],

packages/perspective-webpack-plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"worker-loader": "^2.0.0"
2828
},
2929
"peerDependencies": {
30-
"@finos/perspective": "0.4.0-rc.3",
30+
"@finos/perspective": "^0.4.2",
3131
"webpack": "^4.35"
3232
}
3333
}

packages/perspective/babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
safari: "12",
1111
edge: "44"
1212
},
13-
modules: false,
13+
modules: process.env.BABEL_MODULE || false,
1414
useBuiltIns: "usage",
1515
corejs: 3
1616
}

packages/perspective/package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@finos/perspective",
33
"version": "0.4.2",
44
"description": "Perspective.js",
5-
"main": "dist/umd/perspective.node.js",
5+
"main": "dist/cjs/perspective.node.js",
66
"unpkg": "dist/umd/perspective.js",
77
"browser": "dist/umd/perspective.inline.js",
88
"module": "dist/umd/perspective.inline.js",
@@ -18,18 +18,17 @@
1818
"scripts": {
1919
"prebuild": "mkdirp dist && mkdirp obj",
2020
"build": "npm-run-all build:babel:* build:webpack build:webpack:umd:inline",
21-
"build:babel:js": "babel src/js --source-maps --out-dir dist/esm",
22-
"build:babel:emsdk": "babel obj --source-maps --out-dir dist/esm",
21+
"build:babel:esm": "babel src/js --source-maps --out-dir dist/esm",
22+
"build:babel:emsdk": "BABEL_MODULE=auto babel dist/obj --source-maps --out-dir dist/cjs",
23+
"build:babel:cjs": "BABEL_MODULE=auto babel dist/esm --source-maps --out-dir dist/cjs",
2324
"build:webpack": "npm-run-all -p build:webpack:* ",
2425
"build:webpack:umd:inline": "webpack --color --config src/config/perspective.inline.config.js",
2526
"build:webpack:umd": "webpack --color --config src/config/perspective.config.js",
26-
"build:webpack:node": "webpack --color --config src/config/perspective.node.config.js",
2727
"docs": "npm-run-all docs:jsdoc docs:deploy",
2828
"docs:jsdoc": "jsdoc2md src/js/perspective.js -p list --separators --no-gfm > README.md",
2929
"docs:deploy": "(echo \"---\nid: perspective\ntitle: perspective API\n---\n\n\"; cat README.md) > ../../docs/obj/perspective.md",
30-
"test:build": "cpx \"test/html/*\" build",
3130
"test:run": "jest --color --ci",
32-
"test": "npm-run-all test:build test:run",
31+
"test": "npm-run-all test:run",
3332
"clean": "rimraf dist"
3433
},
3534
"jest": {

packages/perspective/src/js/perspective.node.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* the Apache License 2.0. The full license can be found in the LICENSE file.
77
*
88
*/
9+
910
const {Client} = require("./api/client.js");
1011
const {Server} = require("./api/server.js");
1112

@@ -21,13 +22,9 @@ const path = require("path");
2122
const load_perspective = require("./psp.async.js").default;
2223

2324
// eslint-disable-next-line no-undef
24-
const RESOLVER = typeof __non_webpack_require__ !== "undefined" ? __non_webpack_require__.resolve : module.require.resolve;
2525

2626
const LOCAL_PATH = path.join(process.cwd(), "node_modules");
27-
28-
const wasm = require("./psp.async.wasm.js");
29-
30-
const buffer = fs.readFileSync(path.join(__dirname, wasm)).buffer;
27+
const buffer = require("./psp.async.wasm.js").default;
3128

3229
const SYNC_SERVER = new (class extends Server {
3330
init(msg) {
@@ -117,9 +114,9 @@ function create_http_server(assets, host_psp) {
117114
if (host_psp || typeof host_psp === "undefined") {
118115
for (let rootDir of DEFAULT_ASSETS) {
119116
try {
120-
let paths = RESOLVER.paths(rootDir + url);
117+
let paths = require.resolve.paths(rootDir + url);
121118
paths = [...paths, ...assets.map(x => path.join(x, "node_modules")), LOCAL_PATH];
122-
let filePath = RESOLVER(rootDir + url, {paths});
119+
let filePath = require.resolve(rootDir + url, {paths});
123120
let content = await read_promise(filePath);
124121
if (typeof content !== "undefined") {
125122
console.log(`200 ${url}`);

packages/perspective/src/js/perspective.wasm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*/
99

10-
import load_perspective from "../../obj/psp.async.js";
10+
import load_perspective from "../../dist/obj/psp.async.js";
1111
import perspective from "./perspective.js";
1212

1313
let _perspective_instance;

0 commit comments

Comments
 (0)