
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
This module is to help writing javascript unit testing in the parameterized way
It supports both mocha@7.x.x and jest@26.x.x
It also should supports any test frameworks whose has the following functionalities
interface TestProvider {
describe: Function;
it: Function;
before?: Function;
after?: Function;
beforeAll?: Function;
afterAll?: Function;
beforeEach: Function;
afterEach: Function;
}
npm i --save-dev p-test-js
or
yarn add --dev p-test-js
import Mocha from "mocha";
import { getDecorators } from 'p-test-js'
const {
testsuite,
testname,
testcase,
before,
after,
beforeEach,
afterEach,
} = getDecorators(Mocha);
import Jest from "@jest/globals";
import { getDecorators } from 'p-test-js'
const {
testsuite,
testname,
testcase,
before,
after,
beforeEach,
afterEach,
} = getDecorators(Jest);
import { expect } from 'chai'
@testsuite("Example test suite #1")
@before(() => console.log("Before #1"))
@after(() => console.log("After #1"))
export class DumpCalculatorTest1 {
@testcase(1, 2, 3)
@testcase(2, 2, 4)
superDumpPlusTest(a: number, b: number, expected: number): void {
const r = a + b;
expect(r).to.be.eq(expected);
}
}
Example test suite #1
Before #1
✓ superDumpPlusTest with 1,2,3
✓ superDumpPlusTest with 2,2,4
After #1
import { expect } from 'chai'
@testsuite("Example test suite #2")
@before(() => console.log("Before #2"))
@after(() => console.log("After #2"))
@beforeEach(() => console.log("Before each #2"))
@afterEach(() => console.log("After each #2"))
export class DumpCalculatorTest2 {
@testname("Example test case #2")
@testcase(1, 2, 3)
@testcase(2, 2, 4)
superDumpPlusTest(a: number, b: number, expected: number): void {
const r = a + b;
expect(r).to.be.eq(expected);
}
}
Example test suite #2
Before #2
Before each #2
✓ Example test case #2 with 1,2,3
After each #2
Before each #2
✓ Example test case #2 with 2,2,4
After each #2
After #2
FAQs
For parameterized javascript unit testing
We found that p-test-js 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.