Skip to content

Commit

Permalink
Update esbuild istanbul plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
thednp committed May 13, 2022
1 parent 95e88dd commit 5d49c6a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cypress/integration/dommatrix.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('DOMMatrix Class Test', () => {
.get('.bg-secondary').then((m) => {
cy.wrap(m[0]).as('dommatrix');
})
.log('These test compare CSSMatrix methods agains the native DOMMatrix.');
.log('These tests compare CSSMatrix methods agains the native DOMMatrix.');
});

it('Test init with no parameter, expect same output as native DOMMatrix', () => {
Expand Down
8 changes: 5 additions & 3 deletions cypress/plugins/esbuild-istanbul.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

const { readFileSync } = require('fs');
const { createInstrumenter } = require('istanbul-lib-instrument');
const debug = require('debug')('istanbul-lib-instrument')
const debug = require('debug');

// import Cypress settings
const { env: { sourceFolder } } = require('../../cypress.json');
let { env: { sourceFolder } } = require('../../cypress.json');
sourceFolder = sourceFolder || 'src';
const [name] = process.cwd().split(/[\\|\/]/).slice(-1);
const sourcePath = sourceFolder.replace(/\\/g,'\/');

Expand All @@ -22,8 +23,9 @@ const esbuildPluginIstanbul = () => ({
build.onLoad({filter: /\.(js|jsx|ts|tsx)$/ },
async ({ path }) => {
const contents = String(readFileSync(path, 'utf8'));
const samePath = path.replace(/\\/g, '/')

if (!sourceFilter.split(/\\|\//).every((word) => path.includes(word))) {
if (!samePath.includes(sourceFilter)) {
return { contents };
}
debug('instrumenting %s for output coverage', path);
Expand Down

0 comments on commit 5d49c6a

Please sign in to comment.