();
+ const { handleSubmit} = methods;
+ const [image, setImage] = React.useState('');
+ const [username, setUserName] = React.useState('');
+ const [password, setPassword] = React.useState('');
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const [resource, setResource]: any[] = React.useState([]);
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
+ const onSubmit = () => {
+ vscode.postMessage({
+ type: 'tekton_bundle',
+ body: {imageDetail: image, resourceDetail: resource, userDetail: username, passwordDetail: password}
+ });
+ }
+
+ return (
+
+
+ Publish Tekton Resources as bundles on OCI registry
+
+
+ This workflow will help to create your own Tekton bundle, push it to the remote registry and reference that in your Tekton manifest. Before running this command make sure you are authenticated to the remote image registry and valid credentials are there in order to push to that registry.
+
+
+
+
+
+
+ {' '}
+ Submit{' '}
+
+
+ );
+}
diff --git a/src/webview/bundle/bundle.style.tsx b/src/webview/bundle/bundle.style.tsx
new file mode 100644
index 00000000..47ae73f0
--- /dev/null
+++ b/src/webview/bundle/bundle.style.tsx
@@ -0,0 +1,45 @@
+/*-----------------------------------------------------------------------------------------------
+ * Copyright (c) Red Hat, Inc. All rights reserved.
+ * Licensed under the MIT License. See LICENSE file in the project root for license information.
+ *-----------------------------------------------------------------------------------------------*/
+
+import { Theme, createStyles } from '@material-ui/core/styles';
+
+// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-unused-vars
+export default (theme: Theme) =>
+ createStyles({
+ root: {
+ '& .MuiFormLabel-root': {
+ color: 'var(--vscode-disabledForeground)',
+ },
+ },
+ button: {
+ textAlign: 'center',
+ overflow: 'hidden',
+ textOverflow: 'ellipsis',
+ color: 'var(--vscode-button-foreground)',
+ '&:hover' :{
+ backgroundColor: '\'#BE0000\' !important',
+ },
+ '&:focus': {
+ backgroundColor: '\'#BE0000\' !important',
+ },
+ '&:disabled' :{
+ opacity: '0.6',
+ background: '\'#BE0000\' !important',
+ },
+ },
+ inputLabel: {
+ '&.shrink': {
+ color: 'var(--vscode-keybindingLabel-foreground)'
+ }
+ },
+ autocompleteLabel: {
+ '& .MuiInputLabel-outlined:not(.MuiInputLabel-shrink)': {
+ color: 'var(--vscode-keybindingLabel-foreground)'
+ },
+ '&.Mui-focused .MuiInputLabel-outlined': {
+ color: 'var(--vscode-keybindingLabel-foreground)'
+ }
+ },
+ })
diff --git a/src/webview/bundle/form-components/FormInputProps.ts b/src/webview/bundle/form-components/FormInputProps.ts
new file mode 100644
index 00000000..027d0583
--- /dev/null
+++ b/src/webview/bundle/form-components/FormInputProps.ts
@@ -0,0 +1,18 @@
+/*-----------------------------------------------------------------------------------------------
+ * Copyright (c) Red Hat, Inc. All rights reserved.
+ * Licensed under the MIT License. See LICENSE file in the project root for license information.
+ *-----------------------------------------------------------------------------------------------*/
+
+/* eslint-disable @typescript-eslint/no-explicit-any */
+
+
+export interface FormInputProps {
+ name?: string;
+ control?: any;
+ label?: string;
+ setValue?: any;
+ getValue?: any;
+ placeHolder?: string;
+ requiredField?: boolean;
+ fieldType?: string;
+}
diff --git a/src/webview/bundle/form-components/FormInputText.tsx b/src/webview/bundle/form-components/FormInputText.tsx
new file mode 100644
index 00000000..a1897196
--- /dev/null
+++ b/src/webview/bundle/form-components/FormInputText.tsx
@@ -0,0 +1,61 @@
+/*-----------------------------------------------------------------------------------------------
+ * Copyright (c) Red Hat, Inc. All rights reserved.
+ * Licensed under the MIT License. See LICENSE file in the project root for license information.
+ *-----------------------------------------------------------------------------------------------*/
+
+import * as React from 'react';
+import { FormInputProps } from './FormInputProps';
+import { InputLabel, TextField } from '@mui/material';
+import { inputLabel } from '../Form';
+
+// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
+export function FormInputText({label, setValue, placeHolder, fieldType }: FormInputProps) {
+ return (
+
+
+ {label}
+
+ fieldset': { borderColor: 'var(--vscode-contrastBorder)' },
+ },
+ '& .MuiOutlinedInput-root:hover': {
+ '& > fieldset': {
+ borderColor: 'var(--vscode-contrastBorder)'
+ }
+ },
+ '& .MuiOutlinedInput-root.Mui-focused': {
+ '& > fieldset': {
+ borderColor: 'var(--vscode-contrastBorder)'
+ }
+ },
+ input: {
+ color: 'var(--vscode-settings-textInputForeground)',
+ backgroundColor: 'var(--vscode-settings-textInputBackground)',
+ borderRadius: '4px'
+ }
+ }}
+ type={fieldType}
+ placeholder={placeHolder}
+ onChange={(text) => {
+ if (label === inputLabel.image) {
+ return setValue(text.target.value.trim());
+ }
+ if (label === inputLabel.password) {
+ return setValue(text.target.value.trim());
+ }
+ if (label === inputLabel.userName) {
+ return setValue(text.target.value.trim());
+ }
+ }}
+ style={{ width: '500px', paddingTop: '10px', paddingBottom: '10px' }}
+ />
+
+ );
+}
diff --git a/src/webview/bundle/form-components/SelectAllTransferList.tsx b/src/webview/bundle/form-components/SelectAllTransferList.tsx
new file mode 100644
index 00000000..20c1858a
--- /dev/null
+++ b/src/webview/bundle/form-components/SelectAllTransferList.tsx
@@ -0,0 +1,144 @@
+/*-----------------------------------------------------------------------------------------------
+ * Copyright (c) Red Hat, Inc. All rights reserved.
+ * Licensed under the MIT License. See LICENSE file in the project root for license information.
+ *-----------------------------------------------------------------------------------------------*/
+
+/* eslint-disable @typescript-eslint/no-unused-vars */
+
+import * as React from 'react';
+import { vscode } from '../index';
+import { FormInputProps } from './FormInputProps';
+import Box from '@mui/material/Box';
+import Autocomplete from '@mui/material/Autocomplete';
+import styled from '@emotion/styled';
+import Popper from '@mui/material/Popper';
+import makeStyles from '@material-ui/core/styles/makeStyles';
+import { MyChip } from './customChip';
+import { InputLabel, TextField } from '@mui/material';
+import '../index.css';
+
+const useStyles = makeStyles((theme) => ({
+ root: {
+ borderRadius: '2px',
+ '& .MuiOutlinedInput-root': {
+ '& > fieldset': { borderColor: 'var(--vscode-contrastBorder)' },
+ },
+ '& .MuiOutlinedInput-root:hover': {
+ '& > fieldset': {
+ borderColor: 'var(--vscode-contrastBorder)'
+ }
+ },
+ '& .MuiOutlinedInput-root.Mui-focused': {
+ '& > fieldset': {
+ borderColor: 'var(--vscode-contrastBorder)'
+ }
+ },
+ '.css-1gywuxd-MuiInputBase-root-MuiOutlinedInput-root': {
+ borderColor: 'var(--vscode-contrastBorder)',
+ },
+ },
+}));
+
+const StyledPopper = styled(Popper)(({ theme }) => ({
+ '& .MuiAutocomplete-groupLabel': {
+ backgroundColor: 'var(--vscode-dropdown-background)',
+ color: 'var(--vscode-foreground)',
+ },
+ '& .MuiAutocomplete-paper': {
+ backgroundColor: 'var(--vscode-dropdown-background)',
+ color: 'var(--vscode-foreground)',
+ transform: 'translate(1px, -1px)',
+ position: 'absolute',
+ width: '500px'
+ }
+}));
+
+
+const imageResource = {
+ 'Task': 'T',
+ 'ClusterTask': 'CT',
+ 'Pipeline': 'PL'
+}
+
+// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
+export function LimitTags({ setValue, getValue }: FormInputProps) {
+ const classes = useStyles();
+ const options3 = vscode.getState().map((option) => {
+ return {
+ ...option
+ };
+ });
+
+ return (
+
+
+ Tekton Resources
+
+
+
option.tektonType}
+ getOptionLabel={(option: { tektonType: string; name: string; }) => option.name}
+ getOptionDisabled={(options) => {
+ if (getValue.length === 10) {
+ return true;
+ }
+ return false;
+ }}
+ isOptionEqualToValue={(event, newValue) => {
+ return (event.name === newValue.name && event.tektonType === newValue.tektonType);
+ }}
+ renderOption={(props, option) => (
+ img': { mr: 2, flexShrink: 0 } }} {...props}>
+
+ {option.name}
+
+ )}
+ onChange={(event, newValue) => {
+ setValue(newValue);
+ }}
+ renderTags={(tagValue, getTagProps) => {
+ return tagValue.map((option, index) => (
+
+ ));
+ }}
+ size="small"
+ renderInput={(params) => (
+
+ )}
+ />
+
+
+ );
+}
diff --git a/src/webview/bundle/form-components/customChip.tsx b/src/webview/bundle/form-components/customChip.tsx
new file mode 100644
index 00000000..23d5f175
--- /dev/null
+++ b/src/webview/bundle/form-components/customChip.tsx
@@ -0,0 +1,30 @@
+/*-----------------------------------------------------------------------------------------------
+ * Copyright (c) Red Hat, Inc. All rights reserved.
+ * Licensed under the MIT License. See LICENSE file in the project root for license information.
+ *-----------------------------------------------------------------------------------------------*/
+
+import * as React from 'react';
+import Chip from '@material-ui/core/Chip';
+import makeStyles from '@material-ui/core/styles/makeStyles';
+
+
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
+const useStyles = makeStyles((theme) => ({
+ label: {
+ color: 'black',
+ }
+}));
+
+// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
+export const MyChip = (props) => {
+ const classes = useStyles();
+ return (
+
+ );
+};
diff --git a/src/webview/bundle/index.css b/src/webview/bundle/index.css
new file mode 100644
index 00000000..ddf46c81
--- /dev/null
+++ b/src/webview/bundle/index.css
@@ -0,0 +1,21 @@
+body {
+ margin: 0;
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
+ sans-serif;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+code {
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
+ monospace;
+}
+
+.MuiSvgIcon-root {
+ color: var(--vscode-keybindingLabel-foreground);
+}
+
+.css-1kxbtff-MuiAutocomplete-root .MuiAutocomplete-tag {
+ color: var(--vscode-keybindingLabel-foreground);
+}
\ No newline at end of file
diff --git a/src/webview/bundle/index.tsx b/src/webview/bundle/index.tsx
new file mode 100644
index 00000000..3dfb13aa
--- /dev/null
+++ b/src/webview/bundle/index.tsx
@@ -0,0 +1,36 @@
+/*-----------------------------------------------------------------------------------------------
+ * Copyright (c) Red Hat, Inc. All rights reserved.
+ * Licensed under the MIT License. See LICENSE file in the project root for license information.
+ *-----------------------------------------------------------------------------------------------*/
+
+import * as React from 'react';
+import * as ReactDOM from 'react-dom';
+import './index.css';
+import App from './App';
+
+declare const acquireVsCodeApi: () => ({ getState(): {tektonType: string, name: string}[]; setState(data: {tektonType: string, name: string}[]): void; postMessage: (msg: unknown) => void });
+export const vscode = acquireVsCodeApi();
+
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+const rootElement: any = document.getElementById('root');
+
+window.addEventListener('message', event => {
+ switch (event.data.type) {
+ case 'tekton_bundle':
+ vscode.setState(event.data.data);
+ ReactDOM.render(
+ ,
+ rootElement
+ );
+ }
+});
+
+const previousState = vscode.getState();
+if (previousState) {
+ ReactDOM.render(
+ ,
+ rootElement
+ );
+}
+
+
diff --git a/src/webview/bundle/style.scss b/src/webview/bundle/style.scss
new file mode 100644
index 00000000..b3a7e307
--- /dev/null
+++ b/src/webview/bundle/style.scss
@@ -0,0 +1,41 @@
+.buttonStyle {
+ text-align: center;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ color: var(--vscode-button-foreground);
+
+ &:hover {
+ background-color: '#BE0000' !important;
+ }
+
+ text-transform: none;
+}
+
+.mainContainer,
+.formContainer,
+.form {
+ display: flex;
+ flex-direction: column;
+ font-family: var(--vscode-font-family);
+ // overflow-y: scroll;
+}
+
+.margin {
+ margin: 1% 1% 1% 3%;
+}
+
+.title {
+ width: 100%;
+ margin-bottom: 1%;
+}
+
+.subTitle {
+ margin-bottom: 3%;
+ max-width: 81%;
+ justify-content: center;
+ word-spacing: 5px;
+ text-align: justify;
+ color: var(--vscode-foreground);
+ font-weight: normal;
+ font-size: 14px;
+}
diff --git a/src/webview/common/list-widget.ts b/src/webview/common/list-widget.ts
index 08e75dd8..ddd03b31 100644
--- a/src/webview/common/list-widget.ts
+++ b/src/webview/common/list-widget.ts
@@ -6,11 +6,6 @@ import './list.css';
import { createDiv } from './dom-util';
import { BaseWidget, Listener, Widget } from './widget';
-interface SizeAndPosition {
- top: number;
- width: number;
-}
-
export abstract class ListWidget extends BaseWidget {
protected itemListChangedListener: Listener | undefined;
diff --git a/src/yaml-support/tkn-code-actions.ts b/src/yaml-support/tkn-code-actions.ts
index fc3f50ba..da0dc117 100644
--- a/src/yaml-support/tkn-code-actions.ts
+++ b/src/yaml-support/tkn-code-actions.ts
@@ -204,6 +204,7 @@ class PipelineCodeActionProvider implements vscode.CodeActionProvider {
content = lines.join('\n');
const taskPart = jsYaml.load(content);
+ // eslint-disable-next-line @typescript-eslint/ban-types
let metadataPart: {} = undefined;
if (taskPart.metadata) {
metadataPart = taskPart.metadata;
diff --git a/src/yaml-support/tkn-definition-providers.ts b/src/yaml-support/tkn-definition-providers.ts
index 021f47f0..0e8c7a55 100644
--- a/src/yaml-support/tkn-definition-providers.ts
+++ b/src/yaml-support/tkn-definition-providers.ts
@@ -82,6 +82,7 @@ export class PipelineDefinitionProvider implements TknTypeDefinitionProvider {
private findResourceDeclaration(resName: string, doc: TknDocument): TknElement | undefined {
const pipeline = doc.getChildren();
+ // eslint-disable-next-line no-unsafe-optional-chaining
for (const param of pipeline.spec.resources?.getChildren()) {
if (param.name.value === resName) {
return param.name;
diff --git a/src/yaml-support/tkn-yaml-scheme-generator.ts b/src/yaml-support/tkn-yaml-scheme-generator.ts
index 64ffee98..241d32e8 100644
--- a/src/yaml-support/tkn-yaml-scheme-generator.ts
+++ b/src/yaml-support/tkn-yaml-scheme-generator.ts
@@ -45,7 +45,7 @@ export function generateScheme(vsDocument: vscode.TextDocument, schemaPath: stri
}
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
+// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
function injectTaskSnippets(templateObj: any, snippets: Snippet<{}>[]): {} {
snippets.push({
label: 'inline task',
@@ -66,7 +66,7 @@ function injectTaskSnippets(templateObj: any, snippets: Snippet<{}>[]): {} {
return templateObj;
}
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
+// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
function injectTasksName(templateObj: any, tasks: string[], tasksRef: string[]): {} {
templateObj.definitions.PipelineTask.properties.runAfter.items.enum = tasks;
@@ -78,7 +78,7 @@ function injectTasksName(templateObj: any, tasks: string[], tasksRef: string[]):
return templateObj;
}
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
+// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
function injectResourceName(templateObj: any, resNames: string[]): {} {
if (resNames && resNames.length > 0) {
templateObj.definitions.PipelineTaskInputResource.properties.resource.enum = resNames;
@@ -89,7 +89,7 @@ function injectResourceName(templateObj: any, resNames: string[]): {} {
}
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
+// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
function injectMarkdownDescription(templateObj: any): {} {
templateObj.definitions.Pipeline.properties.apiVersion.markdownDescription = 'Specifies the API version, for example `tekton.dev/v1beta1`. [more](https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields)';
templateObj.definitions.Pipeline.properties.kind.markdownDescription = 'Identifies this resource object as a `Pipeline` object. [more](https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields)';
diff --git a/test/coverage.ts b/test/coverage.ts
index 9bb5f381..e918497b 100644
--- a/test/coverage.ts
+++ b/test/coverage.ts
@@ -27,62 +27,62 @@ export interface TestRunnerOptions {
export class CoverageRunner {
- private coverageVar = `$$cov_${new Date().getTime()}$$`;
- private transformer: any = undefined;
- private matchFn: any = undefined;
- private instrumenter: any = undefined;
-
- constructor(private options: TestRunnerOptions, private testsRoot: string) {
- if (!options.relativeSourcePath) {
- return;
- }
+ private coverageVar = `$$cov_${new Date().getTime()}$$`;
+ private transformer: any = undefined;
+ private matchFn: any = undefined;
+ private instrumenter: any = undefined;
+
+ constructor(private options: TestRunnerOptions, private testsRoot: string) {
+ if (!options.relativeSourcePath) {
+ return;
}
+ }
- public setupCoverage(): void {
- // Set up Code Coverage, hooking require so that instrumented code is returned
- // eslint-disable-next-line @typescript-eslint/no-this-alias
- const self = this;
- self.instrumenter = new istanbul.Instrumenter({ coverageVariable: self.coverageVar });
- const sourceRoot = paths.join(self.testsRoot, self.options.relativeSourcePath);
-
- // Glob source files
- const srcFiles = glob.sync('**/**.js', {
- cwd: sourceRoot,
- ignore: self.options.ignorePatterns
- });
-
- // Create a match function - taken from the run-with-cover.js in istanbul.
- // eslint-disable-next-line @typescript-eslint/no-var-requires
- const decache = require('decache');
- const fileMap: any = {};
- srcFiles.forEach((file) => {
- const fullPath = paths.join(sourceRoot, file);
- fileMap[fullPath] = true;
-
- // On Windows, extension is loaded pre-test hooks and this mean we lose
- // our chance to hook the Require call. In order to instrument the code
- // we have to decache the JS file so on next load it gets instrumented.
- // This doesn't impact tests, but is a concern if we had some integration
- // tests that relied on VSCode accessing our module since there could be
- // some shared global state that we lose.
- decache(fullPath);
- });
-
- self.matchFn = (file: string): boolean => fileMap[file];
- self.matchFn.files = Object.keys(fileMap);
-
- // Hook up to the Require function so that when this is called, if any of our source files
- // are required, the instrumented version is pulled in instead. These instrumented versions
- // write to a global coverage variable with hit counts whenever they are accessed
- self.transformer = self.instrumenter.instrumentSync.bind(self.instrumenter);
- const hookOpts = { verbose: false, extensions: ['.js'] };
- istanbul.hook.hookRequire(self.matchFn, self.transformer, hookOpts);
-
- // initialize the global variable to stop mocha from complaining about leaks
- global[self.coverageVar] = {};
- }
+ public setupCoverage(): void {
+ // Set up Code Coverage, hooking require so that instrumented code is returned
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
+ const self = this;
+ self.instrumenter = new istanbul.Instrumenter({ coverageVariable: self.coverageVar });
+ const sourceRoot = paths.join(self.testsRoot, self.options.relativeSourcePath);
+
+ // Glob source files
+ const srcFiles = glob.sync('**/**.js', {
+ cwd: sourceRoot,
+ ignore: self.options.ignorePatterns
+ });
+
+ // Create a match function - taken from the run-with-cover.js in istanbul.
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
+ const decache = require('decache');
+ const fileMap: any = {};
+ srcFiles.forEach((file) => {
+ const fullPath = paths.join(sourceRoot, file);
+ fileMap[fullPath] = true;
+
+ // On Windows, extension is loaded pre-test hooks and this mean we lose
+ // our chance to hook the Require call. In order to instrument the code
+ // we have to decache the JS file so on next load it gets instrumented.
+ // This doesn't impact tests, but is a concern if we had some integration
+ // tests that relied on VSCode accessing our module since there could be
+ // some shared global state that we lose.
+ decache(fullPath);
+ });
+
+ self.matchFn = (file: string): boolean => fileMap[file];
+ self.matchFn.files = Object.keys(fileMap);
+
+ // Hook up to the Require function so that when this is called, if any of our source files
+ // are required, the instrumented version is pulled in instead. These instrumented versions
+ // write to a global coverage variable with hit counts whenever they are accessed
+ self.transformer = self.instrumenter.instrumentSync.bind(self.instrumenter);
+ const hookOpts = { verbose: false, extensions: ['.js'] };
+ istanbul.hook.hookRequire(self.matchFn, self.transformer, hookOpts);
+
+ // initialize the global variable to stop mocha from complaining about leaks
+ global[self.coverageVar] = {};
+ }
- /**
+ /**
* Writes a coverage report.
* Note that as this is called in the process exit callback, all calls must be synchronous.
*
@@ -90,63 +90,63 @@ export class CoverageRunner {
*
* @memberOf CoverageRunner
*/
- public reportCoverage(): void {
- // eslint-disable-next-line @typescript-eslint/no-this-alias
- const self = this;
- istanbul.hook.unhookRequire();
- let cov: any;
- if (typeof global[self.coverageVar] === 'undefined' || Object.keys(global[self.coverageVar]).length === 0) {
- console.error('No coverage information was collected, exit without writing coverage information');
+ public reportCoverage(): void {
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
+ const self = this;
+ istanbul.hook.unhookRequire();
+ let cov: any;
+ if (typeof global[self.coverageVar] === 'undefined' || Object.keys(global[self.coverageVar]).length === 0) {
+ console.error('No coverage information was collected, exit without writing coverage information');
+ return;
+ } else {
+ cov = global[self.coverageVar];
+ }
+
+ // TODO consider putting this under a conditional flag
+ // Files that are not touched by code ran by the test runner is manually instrumented, to
+ // illustrate the missing coverage.
+ self.matchFn.files.forEach((file: any) => {
+ if (cov[file]) {
return;
- } else {
- cov = global[self.coverageVar];
}
+ self.transformer(fs.readFileSync(file, 'utf-8'), file);
- // TODO consider putting this under a conditional flag
- // Files that are not touched by code ran by the test runner is manually instrumented, to
- // illustrate the missing coverage.
- self.matchFn.files.forEach((file: any) => {
- if (cov[file]) {
- return;
- }
- self.transformer(fs.readFileSync(file, 'utf-8'), file);
-
- // When instrumenting the code, istanbul will give each FunctionDeclaration a value of 1 in coverState.s,
- // presumably to compensate for function hoisting. We need to reset this, as the function was not hoisted,
- // as it was never loaded.
- Object.keys(self.instrumenter.coverState.s).forEach((key) => {
- self.instrumenter.coverState.s[key] = 0;
- });
-
- cov[file] = self.instrumenter.coverState;
+ // When instrumenting the code, istanbul will give each FunctionDeclaration a value of 1 in coverState.s,
+ // presumably to compensate for function hoisting. We need to reset this, as the function was not hoisted,
+ // as it was never loaded.
+ Object.keys(self.instrumenter.coverState.s).forEach((key) => {
+ self.instrumenter.coverState.s[key] = 0;
});
- // TODO Allow config of reporting directory with
- const reportingDir = paths.join(self.testsRoot, self.options.relativeCoverageDir);
- const includePid = self.options.includePid;
- const pidExt = includePid ? ('-' + process.pid) : '';
- const coverageFile = paths.resolve(reportingDir, `coverage${pidExt}.json`);
+ cov[file] = self.instrumenter.coverState;
+ });
- // yes, do this again since some test runners could clean the dir initially created
- _mkDirIfExists(reportingDir);
+ // TODO Allow config of reporting directory with
+ const reportingDir = paths.join(self.testsRoot, self.options.relativeCoverageDir);
+ const includePid = self.options.includePid;
+ const pidExt = includePid ? ('-' + process.pid) : '';
+ const coverageFile = paths.resolve(reportingDir, `coverage${pidExt}.json`);
- fs.writeFileSync(coverageFile, JSON.stringify(cov), 'utf8');
+ // yes, do this again since some test runners could clean the dir initially created
+ _mkDirIfExists(reportingDir);
- const remappedCollector = remapIstanbul.remap(cov, {
- warn: (warning: any) => {
- // We expect some warnings as any JS file without a typescript mapping will cause this.
- // By default, we'll skip printing these to the console as it clutters it up
- if (self.options.verbose) {
- console.warn(warning);
- }
- }
- });
+ fs.writeFileSync(coverageFile, JSON.stringify(cov), 'utf8');
- const reporter = new istanbul.Reporter(undefined, reportingDir);
- const reportTypes = (self.options.reports instanceof Array) ? self.options.reports : ['lcov'];
- reporter.addAll(reportTypes);
- reporter.write(remappedCollector, true, () => {
- console.log(`reports written to ${reportingDir}`);
- });
- }
+ const remappedCollector = remapIstanbul.remap(cov, {
+ warn: (warning: any) => {
+ // We expect some warnings as any JS file without a typescript mapping will cause this.
+ // By default, we'll skip printing these to the console as it clutters it up
+ if (self.options.verbose) {
+ console.warn(warning);
+ }
+ }
+ });
+
+ const reporter = new istanbul.Reporter(undefined, reportingDir);
+ const reportTypes = (self.options.reports instanceof Array) ? self.options.reports : ['lcov'];
+ reporter.addAll(reportTypes);
+ reporter.write(remappedCollector, true, () => {
+ console.log(`reports written to ${reportingDir}`);
+ });
+ }
}
diff --git a/test/debugger/debug.test.ts b/test/debugger/debug.test.ts
index 9d1f050a..c875c1bd 100644
--- a/test/debugger/debug.test.ts
+++ b/test/debugger/debug.test.ts
@@ -106,7 +106,8 @@ suite('debug', () => {
test('return null if debugger is not enable', async () => {
const tknVersion = 'Client version: 0.12.1\nPipeline version: v0.26.3\nTriggers version: v0.5.0\n';
cliExecStub.onFirstCall().resolves({ error: null, stdout: tknVersion, stderr: '' });
- cliExecStub.onSecondCall().resolves({ error: null, stdout: JSON.stringify({
+ cliExecStub.onSecondCall().resolves({ error: null, stdout: null, stderr: '' });
+ cliExecStub.onThirdCall().resolves({ error: null, stdout: JSON.stringify({
data: {
'enable-api-fields': 'stable'
}
@@ -114,28 +115,30 @@ suite('debug', () => {
const result = await startDebugger(taskRunNode);
expect(result).equals(null);
showWarningMessageStub.calledOnce;
- expect(cliExecStub).calledTwice;
+ expect(cliExecStub).calledThrice;
});
test('return null if fail to fetch the feature-flags data', async () => {
const tknVersion = 'Client version: 0.12.1\nPipeline version: v0.26.3\nTriggers version: v0.5.0\n';
cliExecStub.onFirstCall().resolves({ error: null, stdout: tknVersion, stderr: '' });
- cliExecStub.onSecondCall().resolves({ error: 'err', stdout: '', stderr: '' });
+ cliExecStub.onSecondCall().resolves({ error: null, stdout: null, stderr: '' });
+ cliExecStub.onThirdCall().resolves({ error: 'err', stdout: '', stderr: '' });
const result = await startDebugger(taskRunNode);
expect(result).equals(null);
showErrorMessageStub.calledOnce;
- expect(cliExecStub).calledTwice;
+ expect(cliExecStub).calledThrice;
});
test('return null if fail to create taskRun for debugger', async () => {
const tknVersion = 'Client version: 0.12.1\nPipeline version: v0.26.3\nTriggers version: v0.5.0\n';
cliExecStub.onFirstCall().resolves({ error: null, stdout: tknVersion, stderr: '' });
- cliExecStub.onSecondCall().resolves({ error: null, stdout: JSON.stringify({
+ cliExecStub.onSecondCall().resolves({ error: null, stdout: null, stderr: '' });
+ cliExecStub.onThirdCall().resolves({ error: null, stdout: JSON.stringify({
data: {
'enable-api-fields': 'alpha'
}
}), stderr: '' });
- cliExecStub.onThirdCall().resolves({ error: null, stdout: JSON.stringify({
+ cliExecStub.onCall(3).resolves({ error: null, stdout: JSON.stringify({
metadata: {
labels: {
test: 'test'
@@ -149,7 +152,7 @@ suite('debug', () => {
status: 'string'
}
}), stderr: '' });
- cliExecStub.onCall(3).resolves({ error: 'err', stdout: null, stderr: '' });
+ cliExecStub.onCall(4).resolves({ error: 'err', stdout: null, stderr: '' });
const result = await startDebugger(taskRunNode);
expect(result).equals(null);
showErrorMessageStub.calledOnce;
@@ -162,12 +165,13 @@ suite('debug', () => {
test('start taskRun in debug mode', async () => {
const tknVersion = 'Client version: 0.12.1\nPipeline version: v0.26.3\nTriggers version: v0.5.0\n';
cliExecStub.onFirstCall().resolves({ error: null, stdout: tknVersion, stderr: '' });
- cliExecStub.onSecondCall().resolves({ error: null, stdout: JSON.stringify({
+ cliExecStub.onSecondCall().resolves({ error: null, stdout: null, stderr: '' });
+ cliExecStub.onThirdCall().resolves({ error: null, stdout: JSON.stringify({
data: {
'enable-api-fields': 'alpha'
}
}), stderr: '' });
- cliExecStub.onThirdCall().resolves({ error: null, stdout: JSON.stringify({
+ cliExecStub.onCall(3).resolves({ error: null, stdout: JSON.stringify({
metadata: {
labels: {
test: 'test'
@@ -181,7 +185,7 @@ suite('debug', () => {
status: 'string'
}
}), stderr: '' });
- cliExecStub.onCall(3).resolves({ error: null, stdout: JSON.stringify(taskRunData), stderr: '' });
+ cliExecStub.onCall(4).resolves({ error: null, stdout: JSON.stringify(taskRunData), stderr: '' });
await startDebugger(taskRunNode);
safeDumpStub.calledOnce;
osStub.calledOnce;
diff --git a/test/index.ts b/test/index.ts
index 3d917638..e3d17159 100644
--- a/test/index.ts
+++ b/test/index.ts
@@ -5,6 +5,7 @@
'use strict';
+// eslint-disable-next-line @typescript-eslint/no-var-requires
require('source-map-support').install();
/* eslint-disable @typescript-eslint/no-explicit-any */
diff --git a/test/single-test-run.ts b/test/single-test-run.ts
index 0f9003dd..634e01d0 100644
--- a/test/single-test-run.ts
+++ b/test/single-test-run.ts
@@ -16,6 +16,7 @@ if (!tty.getWindowSize) {
};
}
+// eslint-disable-next-line @typescript-eslint/ban-types
const config: {} = {
ui: 'tdd',
timeout: 15000,
@@ -25,6 +26,7 @@ const config: {} = {
const mocha = new Mocha(config);
+// eslint-disable-next-line @typescript-eslint/ban-types
export function run(testsRoots: string, cb: (error: {}, failures?: number) => void): void {
const testsRoot = path.resolve(__dirname);
diff --git a/test/tkn.test.ts b/test/tkn.test.ts
index 0571b7d4..50bc9f34 100644
--- a/test/tkn.test.ts
+++ b/test/tkn.test.ts
@@ -1187,6 +1187,7 @@ suite('tkn', () => {
});
test('TaskRun should contains condition run node', () => {
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
const json = require(path.join('..', '..', 'test', 'pipelinerun.json')) as PipelineRunData;
const pipelineRun = new PipelineRun(pipelineItem, json.metadata.name, undefined, json, TreeItemCollapsibleState.Expanded);
diff --git a/webpack.config.js b/webpack.config.js
index 0187fac0..fb677f62 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -11,6 +11,7 @@ module.exports = {
entry: {
'pipeline-preview': {import: './src/webview/pipeline-preview/index.ts', filename: 'webview/[name]/index.js'},
'pipeline-wizard': {import: './src/webview/pipeline/app/index.ts', filename: 'webview/[name]/index.js'},
+ 'bundle': {import: './src/webview/bundle/index.tsx', filename: 'webview/[name]/index.js'},
'tekton-hub': {import: './src/webview/hub/index.ts', filename: 'webview/[name]/index.js'},
'resource-view': {import: './src/webview/resource-page/index.ts', filename: 'webview/[name]/index.js'}
},
@@ -28,13 +29,16 @@ module.exports = {
exclude: /node_modules/,
},
{
- test: /\.css$/,
+ test: /\.(css|scss)$/,
use: [
{
- loader: 'style-loader'
+ loader: 'style-loader',
},
{
- loader: 'css-loader'
+ loader: 'css-loader',
+ },
+ {
+ loader: 'sass-loader',
}
]
},