Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@asdgf/core
Advanced tools
@asdgf/core
A stupid simple way to test
No magic, no nonsense.
import { describe, executeTests } from '@asdgf/core';
import { expect } from '@open-wc/testing';
import { sum } from 'sum';
describe('sum', ({it, before, /* beforeEach, after, afterEach */}) => {
before(() => {
console.log('hello world');
});
it('adds two numbers', () => {
expect(sum(1,1)).to.equal(2);
});
});
/**
* Returns a test report
*/
executeTests().then(console.log);
You can also nest suites:
describe('foo', ({it, /* before, beforeEach, after, afterEach */}) => {
it('does foo', () => {
expect(true).to.equal(true);
});
/** Make sure to destructure `it` from the suite */
describe('bar', ({it}) => {
it('does bar', () => {
expect(true).to.equal(true);
});
});
});
import { describe } from 'asdgf';
import { expect, html } from '@open-wc/testing';
import { fixture, fixtureCleanup } from '@open-wc/testing-helpers/pure';
class MyEl extends HTMLElement {
connectedCallback() {
this.innerHTML = `hello world`;
}
}
customElements.define('my-el', MyEl);
describe('MyEl', ({it, afterEach}) => {
afterEach(fixtureCleanup);
it('renders', async () => {
const el = await fixture(html`<my-el></my-el>`);
expect(el.textContent).to.equal('hello world');
});
});
You can provide a custom renderer to render progress in the browser, or log progress to the console.
import { executeTests } from '@asdgf/core';
/**
* Log progress to the console
*/
const renderer = {
/** Runs before all suites run, depending on the integration */
start: () => {},
/** Runs before the suite starts, can be used for set up */
suiteStart: ({name, only, tests}) => {
console.log(`Starting suite: [${name}]`);
},
/** Runs after every ran test, whether it's skipped, passed, or failed */
renderTest: (testResult) => {
console.log(`${testResult.name}: ${testResult.passed ? '✅' : '❌'}`);
},
/** Runs after the entire suite has ran */
suiteEnd: (testSuiteResult) => {
console.log(`End of suite: [${testSuiteResult.name}]`);
},
/** Runs after all suites run, depending on the integration */
end: () => {}
}
executeTests({renderer});
import { executeTests } from '@asdgf/core';
import '@asdgf/ui/test-report.js';
/**
* Render progress to the browser
*/
const renderer = {
/** Runs after every ran test, whether it's skipped, passed, or failed */
renderTest: (testResult) => {
const result = document.createElement('test-result');
result.test = testResult;
document.body.appendChild(result);
},
}
executeTests({renderer});
npm i -D @asdgf/web-test-runner
web-test-runner.config.mjs
:
export default {
/**
* Point WTR to `asdgf` as the testFramework of choice
*/
testFramework: { path: 'node_modules/@asdgf/web-test-runner/index.js' },
};
This project was inspired by uvu.
FAQs
A stupid simple way to test
The npm package @asdgf/core receives a total of 2 weekly downloads. As such, @asdgf/core popularity was classified as not popular.
We found that @asdgf/core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.