Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@open-wc/testing
Advanced tools
Part of Open Web Component Recommendation open-wc
We want to provide a good set of defaults on how to facilitate your web component.
Having tests should be the fundament of every production ready product.
We recommend using BDD(Behavior Driven Development) as it seem to be easier when talking to non tech collegues. However note that this can still be a personal preference - we give this recommendation to promote unity within everyone using this recommendation.
Using:
::: tip Info This is part of the default open-wc recommendation :::
npx -p yo -p generator-open-wc -c 'yo open-wc:testing-bare'
yarn add @open-wc/testing --dev
Add to your test:
import { expect } '@open-wc/testing';
This will have the following side effect:
fixture
and litFixture
A typical webcomponent test will look something like this:
/* eslint-disable no-unused-expressions */
import {
html,
fixture,
litFixture,
expect,
} from '@open-wc/testing';
describe('True Checking', () => {
it('is false by default', async () => {
const el = await fixture('<is-true></is-true>');
expect(el.result).to.be.false;
});
it('false values will have a light-dom of <p>NOPE</p>', async () => {
const el = await fixture('<is-true></is-true>');
expect(el).dom.to.semantically('<is-true><p>NOPE</p></is-true>');
});
it('true values will have a light-dom of <p>YEAH</p>', async () => {
const el = await litFixture(html`<is-true .value=${1 === 1}></set-game>`);
expect(el.result).to.be.true;
expect(el).dom.to.semantically('<is-true><p>YEAH</p></is-true>');
});
});
For some real tests look at our Set-Game Example Test Files.
FAQs
Testing following open-wc recommendations
We found that @open-wc/testing demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.