Skip to content

Commit

Permalink
fixed env var failOnNotFound (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmisty authored Aug 9, 2023
1 parent e05fc95 commit f6ffee5
Show file tree
Hide file tree
Showing 13 changed files with 410 additions and 138 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
/lib
/js-files-cypress
/node_modules
all-tests.ts
all-tests.ts
/allure-results
/allure-report
13 changes: 13 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ jobs:
- name: Show coverage
run: npm run cov:show

- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: ./reports/coverage-full/

- name: Comment coverage
continue-on-error: true
uses: danhunsaker/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
clover-file: ./reports/coverage-full/clover.xml

- name: Monitor coverage
run: npm run cov:check

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ filtered.json
/reports
/.nyc_output
/coverage-nyc
/allure-results
/allure-report

# emitted
/js-files-cypress
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ Examples:
- `GREP='=/(?=.*@smoke)(?=.*@p1).*/i'` - runs all tests that have `@smoke` AND `@p1` tags
- `GREP='=/^(?!.*@smoke)(?!.*@p1).*$/i'` - runs all tests WITHOUT `@smoke` and WITHOUT `@p1`
- `GREP='=/(?=.*@smoke)(?=.*@p1).*/i'` - runs all tests WITH `@smoke` and WITH `@p1`
- `GREP='=/(?!.*@smoke)(?=.*@p1)/i'` - runs all tests WITH `@smoke` and with `@tags`
- `GREP='=/(?!.*@smoke)(?=.*@p1)/i'` - runs all tests WITHOUT `@smoke` and with `@p1`
- `GREP='=/@P[12]/'` - runs all tests with `@P1` or `@P2`
### UI Control
Expand Down
2 changes: 2 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const cypressFolder = 'integration';
export default defineConfig({
env: {
GREP_SHOW_UI_CONTROL: true,
REDIRECT_BROWSER_LOG: true,
allure: true,
},
watchForFileChanges: false,
e2e: {
Expand Down
5 changes: 5 additions & 0 deletions integration/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { preprocessor } from './ts-preprocessor';
import { existsSync, rmdirSync } from 'fs';
import { resolve } from 'path';
import { COVERAGE } from '../common/constants';
import { redirectLog } from 'cypress-redirect-browser-log/plugins';
import { configureAllureAdapterPlugins } from '@mmisty/cypress-allure-adapter/plugins';

/**
* Clear compiled js files from previous runs, otherwise coverage will be messed up
Expand Down Expand Up @@ -33,6 +35,9 @@ export const setupPlugins = (on: PluginEvents, config: PluginConfigOptions) => {

on('file:preprocessor', preprocessor(isCov));

redirectLog(on, config, ['exception', 'test:log', 'log', 'warn']);
configureAllureAdapterPlugins(on, config);

// It's IMPORTANT to return the config object
// with any changed environment variables
return config;
Expand Down
8 changes: 7 additions & 1 deletion integration/support/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { registerCypressGrep } from 'cy-local';
import { COVERAGE } from '../common/constants';
import { redirectTestLogs } from 'cypress-redirect-browser-log';
import { allureAdapterSetup } from '@mmisty/cypress-allure-adapter';

const setupCoverage = () => {
if (Cypress.env(COVERAGE) === 'true' || Cypress.env(COVERAGE) === true) {
Expand All @@ -15,10 +17,14 @@ const valBoolEq = (name: string, value: boolean): boolean => {
};

setupCoverage();

redirectTestLogs({
isLogCommandDetails: false,
});
registerCypressGrep({
addControlToUI: valBoolEq('GREP_SHOW_UI_CONTROL', true),
showTagsInTitle: valBoolEq('GREP_SHOW_TAGS_IN_TITLE', true),
showExcludedTests: valBoolEq('GREP_SHOW_EXCLUDED_TESTS', true),
debugLog: true,
});

allureAdapterSetup();
2 changes: 1 addition & 1 deletion nyc.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
instrument: false,
'report-dir': reportDir,
'temp-dir': tempDir,
branches: 70,
branches: 65,
lines: 60,
functions: 60,
statements: 75,
Expand Down
Loading

0 comments on commit f6ffee5

Please sign in to comment.