Exclude Spec files from CodeCov - mct4563 (#4714)

This commit is contained in:
Scott Bell 2022-01-14 02:07:57 +01:00 committed by GitHub
parent 6bcc9bfd84
commit 7a7202f75b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 73 additions and 6 deletions

View File

@ -14,8 +14,6 @@ coverage:
range: "66...100"
ignore:
- "**/*Spec.js"
- "e2e"
parsers:
gcov:

View File

@ -33,11 +33,10 @@ if (coverageEnabled) {
module.exports = (config) => {
const webpackConfig = require('./webpack.dev.js');
delete webpackConfig.output;
if (coverageEnabled) {
webpackConfig.module.rules.push({
test: /\.js$/,
exclude: /node_modules|example|lib|dist/,
exclude: /node_modules|e2e|example|lib|dist|\.*.*Spec\.js/,
use: {
loader: 'istanbul-instrumenter-loader',
options: {
@ -103,7 +102,7 @@ module.exports = (config) => {
reports: ['lcovonly', 'text-summary'],
thresholds: {
global: {
lines: 66
lines: 55
}
}
},

View File

@ -25,7 +25,7 @@
*/
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 newTabParams = [];
for (let key in urlParams) {

70
src/tools/urlSpec.js Normal file
View 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');
});
});
});