Skip to content

Commit 5d49c6a

Browse files
committed
Update esbuild istanbul plugin
1 parent 95e88dd commit 5d49c6a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

cypress/integration/dommatrix.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('DOMMatrix Class Test', () => {
1616
.get('.bg-secondary').then((m) => {
1717
cy.wrap(m[0]).as('dommatrix');
1818
})
19-
.log('These test compare CSSMatrix methods agains the native DOMMatrix.');
19+
.log('These tests compare CSSMatrix methods agains the native DOMMatrix.');
2020
});
2121

2222
it('Test init with no parameter, expect same output as native DOMMatrix', () => {

cypress/plugins/esbuild-istanbul.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33

44
const { readFileSync } = require('fs');
55
const { createInstrumenter } = require('istanbul-lib-instrument');
6-
const debug = require('debug')('istanbul-lib-instrument')
6+
const debug = require('debug');
77

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

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

26-
if (!sourceFilter.split(/\\|\//).every((word) => path.includes(word))) {
28+
if (!samePath.includes(sourceFilter)) {
2729
return { contents };
2830
}
2931
debug('instrumenting %s for output coverage', path);

0 commit comments

Comments
 (0)