mirror of
https://github.com/nasa/openmct.git
synced 2025-02-06 11:09:21 +00:00
Exclude Spec files from CodeCov - mct4563 (#4714)
This commit is contained in:
parent
6bcc9bfd84
commit
7a7202f75b
@ -14,8 +14,6 @@ coverage:
|
|||||||
range: "66...100"
|
range: "66...100"
|
||||||
|
|
||||||
ignore:
|
ignore:
|
||||||
- "**/*Spec.js"
|
|
||||||
- "e2e"
|
|
||||||
|
|
||||||
parsers:
|
parsers:
|
||||||
gcov:
|
gcov:
|
||||||
|
@ -33,11 +33,10 @@ if (coverageEnabled) {
|
|||||||
module.exports = (config) => {
|
module.exports = (config) => {
|
||||||
const webpackConfig = require('./webpack.dev.js');
|
const webpackConfig = require('./webpack.dev.js');
|
||||||
delete webpackConfig.output;
|
delete webpackConfig.output;
|
||||||
|
|
||||||
if (coverageEnabled) {
|
if (coverageEnabled) {
|
||||||
webpackConfig.module.rules.push({
|
webpackConfig.module.rules.push({
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
exclude: /node_modules|example|lib|dist/,
|
exclude: /node_modules|e2e|example|lib|dist|\.*.*Spec\.js/,
|
||||||
use: {
|
use: {
|
||||||
loader: 'istanbul-instrumenter-loader',
|
loader: 'istanbul-instrumenter-loader',
|
||||||
options: {
|
options: {
|
||||||
@ -103,7 +102,7 @@ module.exports = (config) => {
|
|||||||
reports: ['lcovonly', 'text-summary'],
|
reports: ['lcovonly', 'text-summary'],
|
||||||
thresholds: {
|
thresholds: {
|
||||||
global: {
|
global: {
|
||||||
lines: 66
|
lines: 55
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export function paramsToArray(openmct) {
|
export function paramsToArray(openmct) {
|
||||||
// parse urParams from an object to an array.
|
// parse urlParams from an object to an array.
|
||||||
let urlParams = openmct.router.getParams();
|
let urlParams = openmct.router.getParams();
|
||||||
let newTabParams = [];
|
let newTabParams = [];
|
||||||
for (let key in urlParams) {
|
for (let key in urlParams) {
|
||||||
|
70
src/tools/urlSpec.js
Normal file
70
src/tools/urlSpec.js
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
import { createOpenMct, resetApplicationState } from "../utils/testing";
|
||||||
|
import {paramsToArray, identifierToString, default as objectPathToUrl} from "./url";
|
||||||
|
|
||||||
|
describe('the url tool', function () {
|
||||||
|
let openmct;
|
||||||
|
let mockObjectPath;
|
||||||
|
|
||||||
|
beforeEach((done) => {
|
||||||
|
mockObjectPath = [
|
||||||
|
{
|
||||||
|
name: 'mock folder',
|
||||||
|
type: 'fake-folder',
|
||||||
|
identifier: {
|
||||||
|
key: 'mock-folder',
|
||||||
|
namespace: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'mock parent folder',
|
||||||
|
type: 'fake-folder',
|
||||||
|
identifier: {
|
||||||
|
key: 'mock-parent-folder',
|
||||||
|
namespace: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
openmct = createOpenMct();
|
||||||
|
openmct.on('start', () => {
|
||||||
|
openmct.router.setPath(' http://localhost:8020/foobar?testParam1=testValue1');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
openmct.startHeadless();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
return resetApplicationState(openmct);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('paramsToArray', () => {
|
||||||
|
it('exists', () => {
|
||||||
|
expect(paramsToArray).toBeDefined();
|
||||||
|
});
|
||||||
|
it('can construct an array properly from query parameters', () => {
|
||||||
|
const arrayOfParams = paramsToArray(openmct);
|
||||||
|
expect(arrayOfParams.length).toBeDefined();
|
||||||
|
expect(arrayOfParams.length).toBeGreaterThan(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('identifierToString', () => {
|
||||||
|
it('exists', () => {
|
||||||
|
expect(identifierToString).toBeDefined();
|
||||||
|
});
|
||||||
|
it('can construct a String properly from a path', () => {
|
||||||
|
const constructedString = identifierToString(openmct, mockObjectPath);
|
||||||
|
expect(constructedString).toEqual('#/browse/mock-parent-folder/mock-folder');
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('objectPathToUrl', () => {
|
||||||
|
it('exists', () => {
|
||||||
|
expect(objectPathToUrl).toBeDefined();
|
||||||
|
});
|
||||||
|
it('can construct URL properly from a path', () => {
|
||||||
|
const constructedURL = objectPathToUrl(openmct, mockObjectPath);
|
||||||
|
expect(constructedURL).toContain('#/browse/mock-parent-folder/mock-folder');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user