forked from bahmutov/cypress-email-results
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
39 lines (34 loc) · 1.02 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/// <reference types="cypress" />
/**
* @type {Cypress.PluginConfig}
*/
// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
// only register sending the results by email
// if there is an email address
if (process.env.EMAIL_RESULTS_TO) {
console.log(
'will email test results to %s',
process.env.EMAIL_RESULTS_TO.slice(0, 3) + '...',
)
require('../../src')(on, config, {
email: process.env.EMAIL_RESULTS_TO,
emailOnSuccess: true,
dry: false,
})
} else {
console.log('will not send email results')
}
if (process.env.ENVIRONMENT) {
require('../../src')(on, config, {
environment: process.env.ENVIRONMENT
})
}
if (process.env.BASE_STORE) {
require('../../src')(on, config, {
baseStore: process.env.BASE_STORE
})
}
}