mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-21 23:43:15 +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:
|
||||
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:
|
||||
unit-test:
|
||||
name: Unit Tests
|
||||
@ -21,7 +12,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
- name: Install dependencies
|
||||
@ -56,7 +47,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
|
||||
@ -75,19 +66,17 @@ jobs:
|
||||
node ../../bruno-cli/bin/bru.js run --env Prod --output junit.xml --format junit
|
||||
|
||||
- name: Publish Test Report
|
||||
uses: dorny/test-reporter@v1
|
||||
if: success() || failure()
|
||||
uses: EnricoMi/publish-unit-test-result-action@v2
|
||||
if: always()
|
||||
with:
|
||||
name: Test Report
|
||||
path: packages/bruno-tests/collection/junit.xml
|
||||
reporter: java-junit
|
||||
|
||||
files: packages/bruno-tests/collection/junit.xml
|
||||
comment_mode: always
|
||||
prettier:
|
||||
name: Prettier
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
- name: Install dependencies
|
||||
|
@ -11,9 +11,10 @@ const ImportCollection = ({ onClose, handleSubmit }) => {
|
||||
enablePostmanTranslations: {
|
||||
enabled: true,
|
||||
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 = () => {
|
||||
importBrunoCollection()
|
||||
.then((collection) => {
|
||||
@ -46,10 +47,13 @@ const ImportCollection = ({ onClose, handleSubmit }) => {
|
||||
.catch((err) => toastError(err, 'OpenAPI v3 Import collection failed'));
|
||||
};
|
||||
const toggleOptions = (event, optionKey) => {
|
||||
setOptions({ ...options, [optionKey]: {
|
||||
setOptions({
|
||||
...options,
|
||||
[optionKey]: {
|
||||
...options[optionKey],
|
||||
enabled: !options[optionKey].enabled
|
||||
} });
|
||||
}
|
||||
});
|
||||
};
|
||||
const CollectionButton = ({ children, className, onClick }) => {
|
||||
return (
|
||||
@ -61,25 +65,17 @@ const ImportCollection = ({ onClose, handleSubmit }) => {
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
return (
|
||||
<Modal size="sm" title="Import Collection" hideFooter={true} handleConfirm={onClose} handleCancel={onClose}>
|
||||
<div className="flex flex-col">
|
||||
<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">
|
||||
<CollectionButton onClick={handleImportBrunoCollection}>
|
||||
Bruno Collection
|
||||
</CollectionButton>
|
||||
<CollectionButton onClick={handleImportPostmanCollection}>
|
||||
Postman Collection
|
||||
</CollectionButton>
|
||||
<CollectionButton onClick={handleImportInsomniaCollection}>
|
||||
Insomnia Collection
|
||||
</CollectionButton>
|
||||
<CollectionButton onClick={handleImportOpenapiCollection}>
|
||||
OpenAPI V3 Spec
|
||||
</CollectionButton>
|
||||
<CollectionButton onClick={handleImportBrunoCollection}>Bruno Collection</CollectionButton>
|
||||
<CollectionButton onClick={handleImportPostmanCollection}>Postman Collection</CollectionButton>
|
||||
<CollectionButton onClick={handleImportInsomniaCollection}>Insomnia Collection</CollectionButton>
|
||||
<CollectionButton onClick={handleImportOpenapiCollection}>OpenAPI V3 Spec</CollectionButton>
|
||||
</div>
|
||||
<div className="flex justify-start w-full mt-4 max-w-[450px]">
|
||||
{Object.entries(options || {}).map(([key, option]) => (
|
||||
@ -91,7 +87,7 @@ const ImportCollection = ({ onClose, handleSubmit }) => {
|
||||
name="comments"
|
||||
type="checkbox"
|
||||
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"
|
||||
/>
|
||||
</div>
|
||||
|
@ -45,11 +45,7 @@ const ImportCollectionLocation = ({ onClose, handleSubmit, collectionName }) =>
|
||||
const onSubmit = () => formik.handleSubmit();
|
||||
|
||||
return (
|
||||
<Modal
|
||||
size="sm"
|
||||
title="Import Collection"
|
||||
confirmText="Import"
|
||||
handleConfirm={onSubmit} handleCancel={onClose}>
|
||||
<Modal size="sm" title="Import Collection" confirmText="Import" handleConfirm={onSubmit} handleCancel={onClose}>
|
||||
<form className="bruno-form" onSubmit={formik.handleSubmit}>
|
||||
<div>
|
||||
<label htmlFor="collectionName" className="block font-semibold">
|
||||
|
@ -25,15 +25,15 @@ export const ThemeProvider = (props) => {
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const root = window.document.documentElement
|
||||
root.classList.remove("light", "dark");
|
||||
const root = window.document.documentElement;
|
||||
root.classList.remove('light', 'dark');
|
||||
if (storedTheme === 'system') {
|
||||
const isBrowserThemeLight = window.matchMedia('(prefers-color-scheme: light)').matches;
|
||||
setDisplayedTheme(isBrowserThemeLight ? 'light' : 'dark');
|
||||
root.classList.add(isBrowserThemeLight ? 'light' : 'dark')
|
||||
root.classList.add(isBrowserThemeLight ? 'light' : 'dark');
|
||||
} else {
|
||||
setDisplayedTheme(storedTheme);
|
||||
root.classList.add(storedTheme)
|
||||
root.classList.add(storedTheme);
|
||||
}
|
||||
}, [storedTheme, setDisplayedTheme, window.matchMedia]);
|
||||
|
||||
|
@ -123,12 +123,12 @@ const importPostmanV2CollectionItem = (brunoParent, item, parentAuth, options) =
|
||||
}
|
||||
if (Array.isArray(event.script.exec)) {
|
||||
brunoRequestItem.request.script.req = event.script.exec
|
||||
.map((line) => options.enablePostmanTranslations.enabled ?
|
||||
postmanTranslation(line) : `// ${line}`).join('\n')
|
||||
.map((line) => (options.enablePostmanTranslations.enabled ? postmanTranslation(line) : `// ${line}`))
|
||||
.join('\n');
|
||||
} else {
|
||||
brunoRequestItem.request.script.req = options.enablePostmanTranslations.enabled ?
|
||||
postmanTranslation(event.script.exec[0]) :
|
||||
`// ${event.script.exec[0]} `;
|
||||
brunoRequestItem.request.script.req = options.enablePostmanTranslations.enabled
|
||||
? postmanTranslation(event.script.exec[0])
|
||||
: `// ${event.script.exec[0]} `;
|
||||
}
|
||||
}
|
||||
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)) {
|
||||
brunoRequestItem.request.tests = event.script.exec
|
||||
.map((line) => options.enablePostmanTranslations.enabled ?
|
||||
postmanTranslation(line) : `// ${line}`).join('\n');
|
||||
.map((line) => (options.enablePostmanTranslations.enabled ? postmanTranslation(line) : `// ${line}`))
|
||||
.join('\n');
|
||||
} else {
|
||||
brunoRequestItem.request.tests = options.enablePostmanTranslations.enabled ?
|
||||
postmanTranslation(event.script.exec[0]) :
|
||||
`// ${event.script.exec[0]} `;
|
||||
brunoRequestItem.request.tests = options.enablePostmanTranslations.enabled
|
||||
? postmanTranslation(event.script.exec[0])
|
||||
: `// ${event.script.exec[0]} `;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user