- Linting (ESLint): Check eslintrc file itself

- Linting: Add linting plugins (mocha, chai-expect, chai-friendly, cypress)
- Testing: Change cypress plugins file to ESM (so can set up any needed unit testing tasks)
This commit is contained in:
Brett Zamir
2020-02-21 16:34:55 +08:00
parent b1ceb3c911
commit e60812e196
6 changed files with 340 additions and 245 deletions

View File

@@ -1,5 +1,4 @@
/* globals module, require */
/* eslint-disable import/no-commonjs */
'use strict';
// ***********************************************************
// This example plugins/index.js can be used to load plugins
@@ -11,18 +10,7 @@
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
const codeCoverageTask = require('@cypress/code-coverage/task.js');
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
// https://docs.cypress.io/guides/tooling/code-coverage.html#Install-the-plugin
on('task', codeCoverageTask);
};
require('@babel/register')({
plugins: ['@babel/plugin-transform-modules-commonjs']
});
module.exports = require('./main.js').default;

16
cypress/plugins/main.js Normal file
View File

@@ -0,0 +1,16 @@
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
import codeCoverageTask from '@cypress/code-coverage/task.js';
// eslint-disable-next-line import/no-anonymous-default-export
export default (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
// https://docs.cypress.io/guides/tooling/code-coverage.html#Install-the-plugin
on('task', codeCoverageTask);
};