![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
micro-should
Advanced tools
Micro testing framework with familiar syntax, multi-env ESM support & parallel execution
Micro testing framework with familiar syntax, multi-env ESM support & parallel execution.
Used in noble cryptography and many other packages.
npm install micro-should
jsr add jsr:@paulmillr/micro-should
Basic methods:
should(title, case)
or it(title, case)
syntax to register a test functionshould.run()
or it.run()
must always be executed in the endENV variables:
MSHOULD_FAST=1
enables parallel execution in node.js and Bun. Values >1 will set worker count.MSHOULD_QUIET=1
enables "quiet" dot reporterAdditional methods:
describe(prefix, cases)
for nested executionbeforeEacn(fn)
to execute code before a function in describe
blockafterEach
to execute code after a function in describe
blockshould.only(title, case)
allows to limit tests to only one caseshould.skip(title, case)
allows to skip functions instead of commenting them outdescribe.skip(prefix, cases)
to skip describe()-sshould.runWhen(import.meta.url)
helper ensures CLI tests are not run
twice if you're using many test files
it.run()
everywhere would fail, because it would try to run same tests twice.it.runWhen(import.meta.url)
would succeed, because it detects whether
current file is launched from CLI and not imported.To run the example in parallel / quiet setting, save it as a.test.js:
MSHOULD_FAST=1 MSHOULD_QUIET=1 node a.test.js
import { should } from 'micro-should';
import * as assert from 'node:assert'; // examples with node:assert
// you can use any assertion library, e.g. Chai or Expect.js
should('add two numbers together', () => {
assert.equal(2 + 2, 4);
});
should('catch errors', () => {
assert.throws(() => {
throw new Error('invalid');
});
});
should('produce correct promise result', async () => {
const fs = await import('node:fs/promises');
const data = await fs.readFile('README.md', 'utf-8');
assert.ok(data.includes('Minimal testing'));
});
should.run();
describe('during any time of day', () => {
describe('without hesitation', () => {
should('multiply two numbers together', () => {
assert.equal(2 * 2, 4);
});
should.skip("disable one test by using skip", () => {
assert.ok(false); // would not execute
});
// should.only("execute only one test", () => {
// assert.ok(true);
// });
});
});
should.run();
// a.test.js
import { should } from 'micro-should';
should('2 + 2', () => {
if (2 + 2 !== 4) throw new Error('invalid');
});
should.runWhen(import.meta.url);
// b.test.js
import * from './a.test.js';
should.runWhen(import.meta.url);
Options which can be set via command line, as environment variables:
MSHOULD_FAST=1
enables parallel execution in node.js and Bun. Values >1 will set worker count.MSHOULD_QUIET=1
enables "quiet" dot reporterOptions which can be set via code:
import { should } from 'micro-should';
should.opts.STOP_AT_ERROR = false; // default=true
should.opts.MSHOULD_QUIET = true; // same as env var
MIT (c) Paul Miller (https://paulmillr.com), see LICENSE file.
FAQs
Micro testing framework with familiar syntax, multi-env ESM support & parallel execution
We found that micro-should demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.