Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cucumber multi-wp installs #101

Open
wants to merge 2 commits into
base: release/1.0.0
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: only parse specified file extensions
ampersarnie committed Jul 17, 2022
commit 742dd63371a963d8dd4fe734909a7c51f2579bb3
9 changes: 9 additions & 0 deletions lib/cypress-plugin/modifySpec.js
Original file line number Diff line number Diff line change
@@ -22,6 +22,13 @@ const path = require('path');
* @returns {String} - New spec file with added before block
*/
module.exports = (fileContents, version, source, target) => {
const re = /(?:\.([^.]+))?$/;

// Only parse the following files.
if (!['js', 'jsx', 'ts', 'tsx'].includes(re.exec(source)[0])) {
return fileContents;
}

const beforeBlock = esprima.parseScript(`
before(() => {
const path = require('path');
@@ -36,6 +43,8 @@ module.exports = (fileContents, version, source, target) => {
});
`).body[0];

console.log(fileContents);

const parsed = esprima.parseModule(fileContents);

const parsedFileWithInsert = {