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

Test npm #2

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9e739ec
Bump numpy version range for Python > 3.9 support
aaroncameron-wk Dec 9, 2022
232e1bd
Merge pull request #353 from aaroncameron-wk/numpy-bump
rmconsole4-wk Dec 12, 2022
b010b60
Dependency updates for node v19
aaroncameron-wk Dec 16, 2022
c7786ed
Update Dockerfile for node 19
aaroncameron-wk Dec 16, 2022
e3afff6
Merge pull request #356 from aaroncameron-wk/node19
rmconsole2-wf Dec 20, 2022
24fbbf8
Update mock requirement from <5.0.0,>=4.0.3 to >=4.0.3,<6.0.0
dependabot[bot] Dec 29, 2022
8c6b0c0
Merge pull request #357 from Workiva/dependabot/pip/mock-gte-4.0.3-an…
austinmatherne-wk Dec 29, 2022
437412a
Node/Python unit test workflows, upgrade to nose2
aaroncameron-wk Jan 13, 2023
533962d
Merge pull request #360 from aaroncameron-wk/unit-test-workflows
rmconsole6-wk Jan 17, 2023
007ef68
Dependabot for Dockerfile, transient Python dependencies
aaroncameron-wk Jan 18, 2023
010e300
testing docker manifests
chrisgustavsen-wf Jan 19, 2023
21b5a06
Merge pull request #361 from aaroncameron-wk/docker-dependabot
rmconsole6-wk Jan 19, 2023
a34d69f
Don't add "no highlight" class to span wrappers.
Jan 24, 2023
f006293
Show warning dialog on more than 10,000 continuation elements.
Jan 25, 2023
cb0f17d
Make limit on continuation elements a viewer configuration option.
Jan 25, 2023
19e59ce
Use "Promise.resolve" static method.
Jan 26, 2023
700ee85
Merge pull request #365 from paulwarren-wk/continuation-limit
rmconsole5-wk Jan 27, 2023
81fa83f
Merge pull request #364 from paulwarren-wk/363-img-highlight-error
rmconsole3-wf Jan 27, 2023
03a1185
Merge branch 'master' of github.com:Workiva/ixbrl-viewer into test-npm
chrisgustavsen-wf Jan 30, 2023
84791df
testing npm
chrisgustavsen-wf Jan 30, 2023
d196157
test
chrisgustavsen-wf Jan 30, 2023
3461397
testing
chrisgustavsen-wf Jan 30, 2023
5ae99e1
testing
chrisgustavsen-wf Jan 30, 2023
26c682c
authToken
chrisgustavsen-wf Jan 30, 2023
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
18 changes: 15 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,21 @@ updates:
time: "02:00"
timezone: America/Chicago
open-pull-requests-limit: 99
allow:
- dependency-type: indirect
reviewers:
- Workiva/xt
- package-ecosystem: docker
directory: "/"
schedule:
interval: daily
time: "02:00"
timezone: America/Chicago
open-pull-requests-limit: 5
reviewers:
- Workiva/xt
allow:
- dependency-name: "python"
ignore:
- dependency-name: numpy
versions:
- ">=1.20"
- dependency-name: "python"
update-types: ["version-update:semver-major", "version-update:semver-minor"]
31 changes: 31 additions & 0 deletions .github/workflows/node-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Run Node Unit Tests
on:
pull_request:
branches:
- master

jobs:
tests:
strategy:
fail-fast: false
matrix:
os:
- macos-12
- ubuntu-22.04
- windows-2022
node-version:
- '14'
- '16'
- '18'
- '19'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/[email protected]
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: |
npm install
- name: Test with npm
run: npm run test
35 changes: 35 additions & 0 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run Python Unit Tests
on:
pull_request:
branches:
- master

jobs:
tests:
strategy:
fail-fast: false
matrix:
os:
- macos-12
- ubuntu-22.04
- windows-2022
python-version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/[email protected]
- name: Install Python 3
uses: actions/[email protected]
with:
cache: 'pip'
check-latest: true
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -r requirements-dev.txt
- name: Test with nose2
run: nose2
18 changes: 13 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
FROM node:16-slim as node-build
FROM node:19-slim as node-build

ARG NPM_CONFIG__AUTH
ARG NPM_CONFIG_REGISTRY=https://workivaeast.jfrog.io/workivaeast/api/npm/npm-prod/
ARG NPM_CONFIG_ALWAYS_AUTH=true
# ARG NPM_CONFIG__AUTH
# ARG NPM_CONFIG_REGISTRY=https://workivaeast.jfrog.io/workivaeast/api/npm/npm-prod/
# ARG NPM_CONFIG_ALWAYS_AUTH=true
ARG GIT_TAG

ARG NPMRC
ARG NPM_CONFIG_USERCONFIG=/.npmrc
RUN reg=$(echo "$NPM_CONFIG_REGISTRY" | cut -d ":" -f 2) && \
echo "$reg:_authToken = $NPM_CONFIG__AUTH" > /.npmrc && \
echo "registry = $NPM_CONFIG_REGISTRY" >> /.npmrc && \
echo "always-auth = true" >> /.npmrc


WORKDIR /build/

COPY package.json /build/
Expand Down Expand Up @@ -58,7 +66,7 @@ RUN sed -i "s/version='0\.0\.0'/version='$VERSION'/" setup.py
# python tests
ARG BUILD_ARTIFACTS_TEST=/test_reports/*.xml
RUN mkdir /test_reports
RUN nosetests --with-xunit --xunit-file=/test_reports/results.xml --cover-html tests.unit_tests
RUN nose2 --plugin nose2.plugins.junitxml --junit-xml-path ../test_reports/results.xml

# pypi package creation
ARG BUILD_ARTIFACTS_PYPI=/build/dist/*.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ iXBRLViewerPlugin/viewer/dist/ixbrl_viewer.js: iXBRLViewerPlugin/viewer/src/*/*
test: testplugin testviewer

testplugin:
nosetests3 tests.unit_tests
nose2

Arelle:
git clone https://github.com/Arelle/Arelle.git Arelle
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Workiva iXBRL Viewer
# Workiva iXBRL Viewer testing for Cristian

The [Workiva](https://www.workiva.com) iXBRL Viewer allows [Inline XBRL](https://www.xbrl.org/ixbrl) (or iXBRL) reports to be viewed interactively in a web browser. The viewer allows users to access the tagged XBRL data embedded in an iXBRL report. Key features include:

Expand Down Expand Up @@ -190,4 +190,4 @@ Run the following command to run javascript unit tests: `npm run test`

In order to run the python unit tests make sure that you have pip installed requirements-dev.txt.

Run the following command to run python unit tests: `nosetests`
Run the following command to run python unit tests: `nose2`
1 change: 1 addition & 0 deletions iXBRLViewerPlugin/viewer/src/html/inspector.html
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ <h3 class="collapsible-header" data-i18n="inspector.associatedFacts">Associated
<span data-i18n="inspector.poweredBy">Powered by</span>
<a href="https://www.workiva.co.uk/solutions/xbrl-and-ixbrl" target="_blank"><img alt="Workiva logo (opens in new window)" src="../img/workiva.svg" /></a>
</div>
<div class="failed-to-load-mask"></div>
</div>
<div class="dialog-mask">
</div>
Expand Down
22 changes: 18 additions & 4 deletions iXBRLViewerPlugin/viewer/src/js/ixbrlviewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@
import interact from 'interactjs'
import $ from 'jquery'
import { iXBRLReport } from "./report.js";
import { Viewer } from "./viewer.js";
import { Viewer, DocumentTooLargeError } from "./viewer.js";
import { Inspector } from "./inspector.js";

export function iXBRLViewer(options) {
this.options = options || {};
this._plugins = [];
this.inspector = new Inspector(this);
this.viewer = null;
this.options = options || {};
options = options || {};
const defaults = {
showValidationWarningOnStart: false,
continuationElementLimit: 10000
}
this.options = {...defaults, ...options};
}

/*
Expand Down Expand Up @@ -226,7 +230,17 @@ iXBRLViewer.prototype.load = function () {
if (iv.options.showValidationWarningOnStart) {
inspector.showValidationWarning();
}
});
})
.catch(err => {
if (err instanceof DocumentTooLargeError) {
$('#ixv .loader').remove();
$('#inspector').addClass('failed-to-load');
}
else {
throw err;
}

})
}
}, 250);
}, 0);
Expand Down
6 changes: 6 additions & 0 deletions iXBRLViewerPlugin/viewer/src/js/messagebox.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,10 @@ export class MessageBox extends Dialog {

super.show(this);
}

showAsync() {
return new Promise((resolve, reject) => {
this.show(() => resolve(true), () => resolve(false));
});
}
}
71 changes: 49 additions & 22 deletions iXBRLViewerPlugin/viewer/src/js/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import { escapeRegex } from './util.js'
import { IXNode } from './ixnode.js';
import { setDefault } from './util.js';
import { DocOrderIndex } from './docOrderIndex.js';
import { MessageBox } from './messagebox.js';

export class DocumentTooLargeError extends Error {}

export function Viewer(iv, iframes, report) {
this._iv = iv;
Expand All @@ -33,31 +36,55 @@ export function Viewer(iv, iframes, report) {
this._currentDocumentIndex = 0;
}

Viewer.prototype._checkContinuationCount = function() {
const continuationCount = Object.keys(this.continuationOfMap).length
if (continuationCount > this._iv.options.continuationElementLimit) {
const contents = $('<div></div>')
.append($('<p></p>').text(`This document contains a very large number of iXBRL elements (found ${continuationCount} ix:continuation elements).`))
.append($('<p></p>').text('You may experience performance problems viewing this document, or the viewer may not load at all.'))
.append($('<p></p>').text('Do you want to continue trying to load this document?'));

const mb = new MessageBox("Large document warning", contents, "Continue", "Cancel");
return mb.showAsync().then((result) => {
if (!result) {
throw new DocumentTooLargeError("Too many continuations");
}
});
}
return Promise.resolve();
}

Viewer.prototype.initialize = function() {
return new Promise((resolve, reject) => {
return new Promise(async (resolve, reject) => {
var viewer = this;
viewer._buildContinuationMaps();
viewer._iframes.each(function (docIndex) {
$(this).data("selected", docIndex == viewer._currentDocumentIndex);
viewer._preProcessiXBRL($(this).contents().find("body").get(0), docIndex);
});

/* Call plugin promise for each document in turn */
(async function () {
for (var docIndex = 0; docIndex < viewer._iframes.length; docIndex++) {
await viewer._iv.pluginPromise('preProcessiXBRL', viewer._iframes.eq(docIndex).contents().find("body").get(0), docIndex);
}
})()
.then(() => viewer._iv.setProgress("Preparing document") )
viewer._checkContinuationCount()
.catch(err => { throw err })
.then(() => {
this._report.setIXNodeMap(this._ixNodeMap);
this._applyStyles();
this._bindHandlers();
this.scale = 1;
this._setTitle(0);
this._addDocumentSetTabs();
resolve();
});

viewer._iframes.each(function (docIndex) {
$(this).data("selected", docIndex == viewer._currentDocumentIndex);
viewer._preProcessiXBRL($(this).contents().find("body").get(0), docIndex);
});

/* Call plugin promise for each document in turn */
(async function () {
for (var docIndex = 0; docIndex < viewer._iframes.length; docIndex++) {
await viewer._iv.pluginPromise('preProcessiXBRL', viewer._iframes.eq(docIndex).contents().find("body").get(0), docIndex);
}
})()
.then(() => viewer._iv.setProgress("Preparing document") )
.then(() => {
this._report.setIXNodeMap(this._ixNodeMap);
this._applyStyles();
this._bindHandlers();
this.scale = 1;
this._setTitle(0);
this._addDocumentSetTabs();
resolve();
});
})
.catch(err => reject(err));
});
}

Expand Down Expand Up @@ -181,7 +208,7 @@ Viewer.prototype._findOrCreateWrapperNode = function(domNode) {
});
}
nodes.each(function (i) {
if (this.getBoundingClientRect().height == 0) {
if (this.getBoundingClientRect().height == 0 && $(this).css('display') !== 'inline') {
$(this).addClass("ixbrl-no-highlight");
}
if (i == 0) {
Expand Down
12 changes: 12 additions & 0 deletions iXBRLViewerPlugin/viewer/src/less/inspector.less
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,18 @@
&.footnote-mode .footnote-mode-off {
display: none;
}

.failed-to-load-mask {
display: none;
}

&.failed-to-load .failed-to-load-mask {
display: block;
background-color: rgb(0 0 0 / 50%);
position: absolute;
width: 100%;
height: 100%;
}
}

.fact-link {
Expand Down
2 changes: 1 addition & 1 deletion iXBRLViewerPlugin/viewer/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ module.exports = {
},
plugins: [
// Ignore all locale files of moment.js
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new webpack.IgnorePlugin({ resourceRegExp: /^\.\/locale$/, contextRegExp: /moment$/ }),
]
};
2 changes: 1 addition & 1 deletion iXBRLViewerPlugin/viewer/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

const merge = require('webpack-merge');
const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const path = require('path');

Expand Down
2 changes: 1 addition & 1 deletion iXBRLViewerPlugin/viewer/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

const merge = require('webpack-merge');
const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const path = require('path');

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"babel-core": "^6.26.3",
"babel-jest": "^26.0.1",
"babel-preset-env": "^1.7.0",
"base64-inline-loader": "^1.1.1",
"base64-inline-loader": "^2.0.1",
"i18next": "^20.3.2",
"jquery-i18next": "^1.2.1",
"chart.js": "^2.9.3",
Expand All @@ -51,9 +51,9 @@
"postcss-less": "^6.0.0",
"stylelint": "^14.9.1",
"stylelint-config-standard": "^28.0.0",
"webpack": "^4.42.0",
"webpack-cli": "^3.3.11",
"webpack-merge": "^4.2.2"
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"webpack-merge": "^5.8.0"
},
"devDependencies": {
"decimal.js": "^10.4.1",
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
lxml>=4.6.3,<5.0.0
mock>=4.0.3,<5.0.0
nose>=1.3.7,<2.0.0
mock>=4.0.3,<6.0.0
nose2>=0.12.0,<1.0.0

-r requirements.txt
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
isodate>=0.6.0,<0.7.0
numpy>=1.19.5,<1.20.0
numpy>=1.19.5,<2.0.0
pycountry>=20.7.3,<21.0.0
1 change: 0 additions & 1 deletion tests/unit_tests/iXBRLViewerPlugin/mock_arelle.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ def mock_arelle():
inferredDecimals=inferredDecimals_effect
)
sys.modules['arelle.webserver.bottle'] = Mock()
sys.modules['arelle.XbrlConst'] = Mock()
Loading