Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Weiss committed Aug 15, 2024
1 parent efea8ea commit 1d608fc
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { expect } from '../../../../../node_modules/@esm-bundle/chai/esm/chai.js';

describe('basic test', () => {
it('works', () => {
window.__coverage__ = 'something';
expect(true).to.equal(true);
});
});
31 changes: 31 additions & 0 deletions integration/test-runner/tests/basic/runBasicTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,37 @@ export function runBasicTest(
const browserCount = config.browsers.length;
let allSessions: TestSession[];

describe('coverage', () => {
before(async () => {
const result = await runTests({
...config,
coverageConfig: {
nativeInstrumentation: false,
},
files: [...(config.files ?? []), resolve(__dirname, 'browser-tests', 'coverage.test.js')],
plugins: [...(config.plugins ?? []), legacyPlugin()],
});
allSessions = result.sessions;

expect(allSessions.every(s => s.passed)).to.equal(true, 'All sessions should have passed');
});

it('passes coverage test', () => {
const sessions = allSessions.filter(s => s.testFile.endsWith('coverage.test.js'));
expect(sessions.length === browserCount).to.equal(
true,
'Each browser should run coverage.test.js',
);
for (const session of sessions) {
expect(session.testCoverage).to.equal('something');
expect(session.testResults!.tests.length).to.equal(0);
expect(session.testResults!.suites.length).to.equal(1);
expect(session.testResults!.suites[0].tests.length).to.equal(1);
expect(session.testResults!.suites[0].tests.map(t => t.name)).to.eql(['works']);
}
});
});

before(async () => {
const result = await runTests({
...config,
Expand Down

0 comments on commit 1d608fc

Please sign in to comment.