Gathering detailed insights and metrics for nunit
Gathering detailed insights and metrics for nunit
Gathering detailed insights and metrics for nunit
Gathering detailed insights and metrics for nunit
jest-nunit-reporter
A NUnit test report formatter for Jest.
testcafe-reporter-xunit
xUnit TestCafe reporter plugin.
gulp-nunit-runner
A Gulp.js plugin to facilitate the running of NUnit unit tests on .Net assemblies.
@fontsource/nunito-sans
Self-host the Nunito Sans font in a neatly bundled NPM package.
npm install nunit
Typescript
Module System
NPM Version
73.3
Supply Chain
98.1
Quality
75
Maintenance
100
Vulnerability
100
License
JavaScript (98%)
CSS (1.65%)
Shell (0.34%)
Total Downloads
7,774
Last Day
3
Last Week
3
Last Month
8
Last Year
1,048
35 Commits
2 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
0.2.1
Package Id
nunit@0.2.1
Size
11.28 kB
NPM Version
1.2.30
Cumulative downloads
Total Downloads
Last day
200%
3
Compared to previous day
Last week
50%
3
Compared to previous week
Last month
-86.9%
8
Compared to previous month
Last year
-50.8%
1,048
Compared to previous year
No dependencies detected.
Neal's unit test framework for JavaScript.
<!-- Include nunit.js -->
<script src="../nunit.js"></script>
<script>
var name = "world";
var test = new NUnit.Test("Test Hello world"); // Create a test module (test case)
test.myTest = function(assert){ // Every method on the test module is a test.
assert.equals("hello world!", "hello " + name + "!");
};
</script>
<!-- nunit-browser.js contains the driver script that looks for all the test modules and runs them with built-in test runner. -->
<!-- It also provides a mini reporter for displaying test results -->
<script src="nunit-browser.js"></script>
var nunit = require("nunit");
var test = new NUnit.Test("Test Hello Node!");
test.myTest = function(assert){
assert.equals("hello Node!", "hello " + "Node" + "!");
};
nunit.execute(); //Use default configuration to run all test modules.
A test module (or test object) is an instance of NUnit.Test
class.
var test = new NUnit.Test("Test description.");
Every function on this module object are treated as one test except these four: before
, after
, beforeAll
, and afterAll
.
If before
and after
was defined on the test object, they will run before and after each test respectively.
If beforeAll
and afterAll
was defined on the test object, they will run before and after all tests respectively.
There are two ways to get to the assert object.
From assert
attribute of the test module
var test = new NUnit.Test("a test module");
var a = test.assert ;
From the first argument of the test function:
test.myTest = function(a){
a.assertTrue(true);
}
And they are equivalent:
test.testAssert = function(a){
a.strictEquals(a, this.assert);
}
equals(obj1, obj2, desc) (Aliases: eq, equal, assertEqual, assertEquals)
Asserts obj1
equals to obj2
. It uses ==
to compare the two. For javascript object it also tries JSON.stringify(obj1) == JSON.stringify(obj2)
. Do not use to compare two null value. Use #isNull to assert a null(or undefined) value.
strictEquals(obj1, obj2, desc) (Aliases: strictEqual, assertStrictEqual, assertStrictEquals)
Asserts obj1
is strictly equal to (===
) obj2
notEqual(obj1, obj2, desc) (Aliases: neq, notEquals, assertNotEqual)
Asserts not equal.
isTrue(obj, desc) (Aliases: t, assertTrue)
Asserts obj
is true
.
isFalse(obj, desc) (Aliases: f, assertFalse)
Asserts obj
is false
.
isNull(obj, desc) (Alias: assertNull)
Asserts obj
is null
or undefined
.
notNull(obj, desc) (Alias: assertNotNull)
Asserts obj
is not null
or undefined
.
fail(msg): Fails the current test with message msg
.
contains(obj1, obj2, desc) (Alias: contain)
Asserts obj1
contains obj2
. It uses indexOf
function on obj1
.
exception(callback, desc): Asserts that the callback
will throw an error.
tracer(): Returns a Tracer
object. A Tracer
object is useful to assure an asynchronized callback has actually been called as well as to verify the number of times it's called.
Tracer
desc
to identify different calls.count
and throws error if failed.For example:
test.testTracer = function(a){
var tr = assert.tracer();
a.notNull(tr);
for(var i = 0 ; i < 10; i++){
tr.trace();
tr.once();
tr.once();//same `desc` as tr.once() above, so it will take no effect
tr.once("second trace.once()");
}
tr.verify(12);
}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More