2021-06-14 18:14:43 +00:00
|
|
|
// ***********************************************************
|
|
|
|
// This example plugins/index.js can be used to load plugins
|
|
|
|
//
|
|
|
|
// You can change the location of this file or turn off loading
|
|
|
|
// the plugins file with the 'pluginsFile' configuration option.
|
|
|
|
//
|
|
|
|
// You can read more here:
|
|
|
|
// https://on.cypress.io/plugins-guide
|
|
|
|
// ***********************************************************
|
2021-06-14 16:37:52 +00:00
|
|
|
|
2021-06-14 18:14:43 +00:00
|
|
|
// This function is called when a project is opened or re-opened (e.g. due to
|
|
|
|
// the project's config changing)
|
|
|
|
/* eslint-disable no-unused-vars */
|
2021-08-24 18:26:48 +00:00
|
|
|
|
|
|
|
const { execSync } = require('child_process');
|
|
|
|
const { existsSync } = require('fs');
|
2021-11-29 18:30:28 +00:00
|
|
|
require('dotenv').config();
|
2021-08-24 18:26:48 +00:00
|
|
|
|
2021-06-14 18:14:43 +00:00
|
|
|
module.exports = (on, config) => {
|
2021-11-29 18:30:28 +00:00
|
|
|
// `on` is used to hook into various events Cypress emits
|
|
|
|
// `config` is the resolved Cypress config
|
|
|
|
config.env = config.env || {};
|
2021-08-24 18:26:48 +00:00
|
|
|
on('before:run', () => {
|
|
|
|
if (!existsSync('../../config/curriculum.json')) {
|
|
|
|
execSync('npm run build:curriculum');
|
|
|
|
}
|
|
|
|
});
|
2021-11-29 18:30:28 +00:00
|
|
|
|
2022-01-18 14:52:49 +00:00
|
|
|
config.env.API_LOCATION = process.env.API_LOCATION;
|
2021-11-29 18:30:28 +00:00
|
|
|
return config;
|
2019-10-05 22:38:38 +00:00
|
|
|
};
|