mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-22 07:53:34 +01:00
fix: resolve build issues (#2041)
* fix: resolve prettier issues * fix: allow checks write access for CLI test * fix: use node 18 in workflows
This commit is contained in:
parent
615ed0c584
commit
e7ff0ba5a8
25
.github/workflows/tests.yml
vendored
25
.github/workflows/tests.yml
vendored
@ -5,15 +5,6 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
# Assign permissions for unit tests to be reported.
|
|
||||||
# See https://github.com/dorny/test-reporter/issues/168
|
|
||||||
permissions:
|
|
||||||
statuses: write
|
|
||||||
checks: write
|
|
||||||
contents: write
|
|
||||||
pull-requests: write
|
|
||||||
actions: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
unit-test:
|
unit-test:
|
||||||
name: Unit Tests
|
name: Unit Tests
|
||||||
@ -21,7 +12,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
@ -56,7 +47,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
|
|
||||||
@ -75,19 +66,17 @@ jobs:
|
|||||||
node ../../bruno-cli/bin/bru.js run --env Prod --output junit.xml --format junit
|
node ../../bruno-cli/bin/bru.js run --env Prod --output junit.xml --format junit
|
||||||
|
|
||||||
- name: Publish Test Report
|
- name: Publish Test Report
|
||||||
uses: dorny/test-reporter@v1
|
uses: EnricoMi/publish-unit-test-result-action@v2
|
||||||
if: success() || failure()
|
if: always()
|
||||||
with:
|
with:
|
||||||
name: Test Report
|
files: packages/bruno-tests/collection/junit.xml
|
||||||
path: packages/bruno-tests/collection/junit.xml
|
comment_mode: always
|
||||||
reporter: java-junit
|
|
||||||
|
|
||||||
prettier:
|
prettier:
|
||||||
name: Prettier
|
name: Prettier
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
@ -11,9 +11,10 @@ const ImportCollection = ({ onClose, handleSubmit }) => {
|
|||||||
enablePostmanTranslations: {
|
enablePostmanTranslations: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
label: 'Auto translate postman scripts',
|
label: 'Auto translate postman scripts',
|
||||||
subLabel: "When enabled, Bruno will try as best to translate the scripts from the imported collection to Bruno's format."
|
subLabel:
|
||||||
|
"When enabled, Bruno will try as best to translate the scripts from the imported collection to Bruno's format."
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
const handleImportBrunoCollection = () => {
|
const handleImportBrunoCollection = () => {
|
||||||
importBrunoCollection()
|
importBrunoCollection()
|
||||||
.then((collection) => {
|
.then((collection) => {
|
||||||
@ -46,10 +47,13 @@ const ImportCollection = ({ onClose, handleSubmit }) => {
|
|||||||
.catch((err) => toastError(err, 'OpenAPI v3 Import collection failed'));
|
.catch((err) => toastError(err, 'OpenAPI v3 Import collection failed'));
|
||||||
};
|
};
|
||||||
const toggleOptions = (event, optionKey) => {
|
const toggleOptions = (event, optionKey) => {
|
||||||
setOptions({ ...options, [optionKey]: {
|
setOptions({
|
||||||
|
...options,
|
||||||
|
[optionKey]: {
|
||||||
...options[optionKey],
|
...options[optionKey],
|
||||||
enabled: !options[optionKey].enabled
|
enabled: !options[optionKey].enabled
|
||||||
} });
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
const CollectionButton = ({ children, className, onClick }) => {
|
const CollectionButton = ({ children, className, onClick }) => {
|
||||||
return (
|
return (
|
||||||
@ -61,25 +65,17 @@ const ImportCollection = ({ onClose, handleSubmit }) => {
|
|||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</button>
|
</button>
|
||||||
)
|
);
|
||||||
}
|
};
|
||||||
return (
|
return (
|
||||||
<Modal size="sm" title="Import Collection" hideFooter={true} handleConfirm={onClose} handleCancel={onClose}>
|
<Modal size="sm" title="Import Collection" hideFooter={true} handleConfirm={onClose} handleCancel={onClose}>
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<h3 className="text-sm">Select the type of your existing collection :</h3>
|
<h3 className="text-sm">Select the type of your existing collection :</h3>
|
||||||
<div className="mt-4 grid grid-rows-2 grid-flow-col gap-2">
|
<div className="mt-4 grid grid-rows-2 grid-flow-col gap-2">
|
||||||
<CollectionButton onClick={handleImportBrunoCollection}>
|
<CollectionButton onClick={handleImportBrunoCollection}>Bruno Collection</CollectionButton>
|
||||||
Bruno Collection
|
<CollectionButton onClick={handleImportPostmanCollection}>Postman Collection</CollectionButton>
|
||||||
</CollectionButton>
|
<CollectionButton onClick={handleImportInsomniaCollection}>Insomnia Collection</CollectionButton>
|
||||||
<CollectionButton onClick={handleImportPostmanCollection}>
|
<CollectionButton onClick={handleImportOpenapiCollection}>OpenAPI V3 Spec</CollectionButton>
|
||||||
Postman Collection
|
|
||||||
</CollectionButton>
|
|
||||||
<CollectionButton onClick={handleImportInsomniaCollection}>
|
|
||||||
Insomnia Collection
|
|
||||||
</CollectionButton>
|
|
||||||
<CollectionButton onClick={handleImportOpenapiCollection}>
|
|
||||||
OpenAPI V3 Spec
|
|
||||||
</CollectionButton>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-start w-full mt-4 max-w-[450px]">
|
<div className="flex justify-start w-full mt-4 max-w-[450px]">
|
||||||
{Object.entries(options || {}).map(([key, option]) => (
|
{Object.entries(options || {}).map(([key, option]) => (
|
||||||
@ -91,7 +87,7 @@ const ImportCollection = ({ onClose, handleSubmit }) => {
|
|||||||
name="comments"
|
name="comments"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={option.enabled}
|
checked={option.enabled}
|
||||||
onChange={(e) => toggleOptions(e,key)}
|
onChange={(e) => toggleOptions(e, key)}
|
||||||
className="h-3.5 w-3.5 rounded border-zinc-300 dark:ring-offset-zinc-800 bg-transparent text-indigo-600 dark:text-indigo-500 focus:ring-indigo-600 dark:focus:ring-indigo-500"
|
className="h-3.5 w-3.5 rounded border-zinc-300 dark:ring-offset-zinc-800 bg-transparent text-indigo-600 dark:text-indigo-500 focus:ring-indigo-600 dark:focus:ring-indigo-500"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,11 +45,7 @@ const ImportCollectionLocation = ({ onClose, handleSubmit, collectionName }) =>
|
|||||||
const onSubmit = () => formik.handleSubmit();
|
const onSubmit = () => formik.handleSubmit();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal size="sm" title="Import Collection" confirmText="Import" handleConfirm={onSubmit} handleCancel={onClose}>
|
||||||
size="sm"
|
|
||||||
title="Import Collection"
|
|
||||||
confirmText="Import"
|
|
||||||
handleConfirm={onSubmit} handleCancel={onClose}>
|
|
||||||
<form className="bruno-form" onSubmit={formik.handleSubmit}>
|
<form className="bruno-form" onSubmit={formik.handleSubmit}>
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="collectionName" className="block font-semibold">
|
<label htmlFor="collectionName" className="block font-semibold">
|
||||||
|
@ -25,15 +25,15 @@ export const ThemeProvider = (props) => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const root = window.document.documentElement
|
const root = window.document.documentElement;
|
||||||
root.classList.remove("light", "dark");
|
root.classList.remove('light', 'dark');
|
||||||
if (storedTheme === 'system') {
|
if (storedTheme === 'system') {
|
||||||
const isBrowserThemeLight = window.matchMedia('(prefers-color-scheme: light)').matches;
|
const isBrowserThemeLight = window.matchMedia('(prefers-color-scheme: light)').matches;
|
||||||
setDisplayedTheme(isBrowserThemeLight ? 'light' : 'dark');
|
setDisplayedTheme(isBrowserThemeLight ? 'light' : 'dark');
|
||||||
root.classList.add(isBrowserThemeLight ? 'light' : 'dark')
|
root.classList.add(isBrowserThemeLight ? 'light' : 'dark');
|
||||||
} else {
|
} else {
|
||||||
setDisplayedTheme(storedTheme);
|
setDisplayedTheme(storedTheme);
|
||||||
root.classList.add(storedTheme)
|
root.classList.add(storedTheme);
|
||||||
}
|
}
|
||||||
}, [storedTheme, setDisplayedTheme, window.matchMedia]);
|
}, [storedTheme, setDisplayedTheme, window.matchMedia]);
|
||||||
|
|
||||||
|
@ -123,12 +123,12 @@ const importPostmanV2CollectionItem = (brunoParent, item, parentAuth, options) =
|
|||||||
}
|
}
|
||||||
if (Array.isArray(event.script.exec)) {
|
if (Array.isArray(event.script.exec)) {
|
||||||
brunoRequestItem.request.script.req = event.script.exec
|
brunoRequestItem.request.script.req = event.script.exec
|
||||||
.map((line) => options.enablePostmanTranslations.enabled ?
|
.map((line) => (options.enablePostmanTranslations.enabled ? postmanTranslation(line) : `// ${line}`))
|
||||||
postmanTranslation(line) : `// ${line}`).join('\n')
|
.join('\n');
|
||||||
} else {
|
} else {
|
||||||
brunoRequestItem.request.script.req = options.enablePostmanTranslations.enabled ?
|
brunoRequestItem.request.script.req = options.enablePostmanTranslations.enabled
|
||||||
postmanTranslation(event.script.exec[0]) :
|
? postmanTranslation(event.script.exec[0])
|
||||||
`// ${event.script.exec[0]} `;
|
: `// ${event.script.exec[0]} `;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.listen === 'test' && event.script && event.script.exec) {
|
if (event.listen === 'test' && event.script && event.script.exec) {
|
||||||
@ -137,12 +137,12 @@ const importPostmanV2CollectionItem = (brunoParent, item, parentAuth, options) =
|
|||||||
}
|
}
|
||||||
if (Array.isArray(event.script.exec)) {
|
if (Array.isArray(event.script.exec)) {
|
||||||
brunoRequestItem.request.tests = event.script.exec
|
brunoRequestItem.request.tests = event.script.exec
|
||||||
.map((line) => options.enablePostmanTranslations.enabled ?
|
.map((line) => (options.enablePostmanTranslations.enabled ? postmanTranslation(line) : `// ${line}`))
|
||||||
postmanTranslation(line) : `// ${line}`).join('\n');
|
.join('\n');
|
||||||
} else {
|
} else {
|
||||||
brunoRequestItem.request.tests = options.enablePostmanTranslations.enabled ?
|
brunoRequestItem.request.tests = options.enablePostmanTranslations.enabled
|
||||||
postmanTranslation(event.script.exec[0]) :
|
? postmanTranslation(event.script.exec[0])
|
||||||
`// ${event.script.exec[0]} `;
|
: `// ${event.script.exec[0]} `;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user