| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - import '../common/index.mjs'; | ||
| 1 | + import { mustCallAtLeast } from '../common/index.mjs'; | ||
| 2 | 2 | import * as fixtures from '../common/fixtures.mjs'; | |
| 3 | 3 | import tmpdir from '../common/tmpdir.js'; | |
| 4 | 4 | ||
@@ -14,7 +14,7 @@ const apilinks = fixtures.path('apilinks'); | |||
| 14 | 14 | ||
| 15 | 15 | tmpdir.refresh(); | |
| 16 | 16 | ||
| 17 | - fs.readdirSync(apilinks).forEach((fixture) => { | ||
| 17 | + fs.readdirSync(apilinks).forEach(mustCallAtLeast((fixture) => { | ||
| 18 | 18 | if (!fixture.endsWith('.js')) return; | |
| 19 | 19 | const input = path.join(apilinks, fixture); | |
| 20 | 20 | ||
@@ -40,4 +40,4 @@ fs.readdirSync(apilinks).forEach((fixture) => { | |||
| 40 | 40 | Object.keys(actualLinks).length, 0, | |
| 41 | 41 | `unexpected links returned ${JSON.stringify(actualLinks)}`, | |
| 42 | 42 | ); | |
| 43 | - }); | ||
| 43 | + })); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -163,13 +163,31 @@ export default [ | |||
| 163 | 163 | 'benchmark', | |
| 164 | 164 | 'cctest', | |
| 165 | 165 | 'client-proxy', | |
| 166 | + 'doctool', | ||
| 167 | + 'embedding', | ||
| 168 | + 'fixtures', | ||
| 169 | + 'fuzzers', | ||
| 170 | + 'js-native-api', | ||
| 171 | + 'known_issues', | ||
| 166 | 172 | 'message', | |
| 167 | 173 | 'module-hooks', | |
| 168 | 174 | 'node-api', | |
| 169 | - 'pummel', | ||
| 175 | + 'nop', | ||
| 176 | + 'overlapped-checker', | ||
| 170 | 177 | 'pseudo-tty', | |
| 178 | + 'pummel', | ||
| 179 | + 'report', | ||
| 180 | + 'sea', | ||
| 181 | + 'sqlite', | ||
| 182 | + 'system-ca', | ||
| 183 | + 'test426', | ||
| 184 | + 'testpy', | ||
| 185 | + 'tick-processor', | ||
| 186 | + 'tools', | ||
| 171 | 187 | 'v8-updates', | |
| 172 | 188 | 'wasi', | |
| 189 | + 'wasm-allocation', | ||
| 190 | + 'wpt', | ||
| 173 | 191 | ].join(',')}}/**/*.{js,mjs,cjs}`, | |
| 174 | 192 | ], | |
| 175 | 193 | rules: { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,14 +3,14 @@ | |||
| 3 | 3 | const common = require('../../../common'); | |
| 4 | 4 | const { suite, test } = require('node:test'); | |
| 5 | 5 | ||
| 6 | - suite('async suite', async () => { | ||
| 6 | + suite('async suite', common.mustCall(async () => { | ||
| 7 | 7 | await 1; | |
| 8 | 8 | test('enabled 1', common.mustCall()); | |
| 9 | 9 | await 1; | |
| 10 | 10 | test('not run', common.mustNotCall()); | |
| 11 | 11 | await 1; | |
| 12 | - }); | ||
| 12 | + })); | ||
| 13 | 13 | ||
| 14 | - suite('sync suite', () => { | ||
| 14 | + suite('sync suite', common.mustCall(() => { | ||
| 15 | 15 | test('enabled 2', common.mustCall()); | |
| 16 | - }); | ||
| 16 | + })); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,6 +9,7 @@ before(() => testArr.push('global before')); | |||
| 9 | 9 | after(() => { | |
| 10 | 10 | testArr.push('global after'); | |
| 11 | 11 | ||
| 12 | + // eslint-disable-next-line node-core/must-call-assert | ||
| 12 | 13 | assert.deepStrictEqual(testArr, [ | |
| 13 | 14 | 'global before', | |
| 14 | 15 | 'describe before', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,7 @@ const { setTimeout } = require('node:timers/promises'); | |||
| 7 | 7 | before((t) => t.diagnostic('before 1 called')); | |
| 8 | 8 | after((t) => t.diagnostic('after 1 called')); | |
| 9 | 9 | ||
| 10 | - describe('describe hooks', () => { | ||
| 10 | + describe('describe hooks', common.mustCall(() => { | ||
| 11 | 11 | const testArr = []; | |
| 12 | 12 | before(function() { | |
| 13 | 13 | testArr.push('before ' + this.name); | |
@@ -51,9 +51,9 @@ describe('describe hooks', () => { | |||
| 51 | 51 | it('nested 1', () => testArr.push('nested 1')); | |
| 52 | 52 | test('nested 2', () => testArr.push('nested 2')); | |
| 53 | 53 | }); | |
| 54 | - }); | ||
| 54 | + })); | ||
| 55 | 55 | ||
| 56 | - describe('describe hooks - no subtests', () => { | ||
| 56 | + describe('describe hooks - no subtests', common.mustCall(() => { | ||
| 57 | 57 | const testArr = []; | |
| 58 | 58 | before(function() { | |
| 59 | 59 | testArr.push('before ' + this.name); | |
@@ -67,18 +67,18 @@ describe('describe hooks - no subtests', () => { | |||
| 67 | 67 | })); | |
| 68 | 68 | beforeEach(common.mustNotCall()); | |
| 69 | 69 | afterEach(common.mustNotCall()); | |
| 70 | - }); | ||
| 70 | + })); | ||
| 71 | 71 | ||
| 72 | 72 | describe('before throws', () => { | |
| 73 | 73 | before(() => { throw new Error('before'); }); | |
| 74 | 74 | it('1', () => {}); | |
| 75 | 75 | test('2', () => {}); | |
| 76 | 76 | }); | |
| 77 | 77 | ||
| 78 | - describe('before throws - no subtests', () => { | ||
| 78 | + describe('before throws - no subtests', common.mustCall(() => { | ||
| 79 | 79 | before(() => { throw new Error('before'); }); | |
| 80 | 80 | after(common.mustCall()); | |
| 81 | - }); | ||
| 81 | + })); | ||
| 82 | 82 | ||
| 83 | 83 | describe('after throws', () => { | |
| 84 | 84 | after(() => { throw new Error('after'); }); | |
@@ -102,11 +102,11 @@ describe('afterEach throws', () => { | |||
| 102 | 102 | test('2', () => {}); | |
| 103 | 103 | }); | |
| 104 | 104 | ||
| 105 | - describe('afterEach when test fails', () => { | ||
| 105 | + describe('afterEach when test fails', common.mustCall(() => { | ||
| 106 | 106 | afterEach(common.mustCall(2)); | |
| 107 | 107 | it('1', () => { throw new Error('test'); }); | |
| 108 | 108 | test('2', () => {}); | |
| 109 | - }); | ||
| 109 | + })); | ||
| 110 | 110 | ||
| 111 | 111 | describe('afterEach throws and test fails', () => { | |
| 112 | 112 | afterEach(() => { throw new Error('afterEach'); }); | |
@@ -246,13 +246,13 @@ test('t.after() is called if test body throws', (t) => { | |||
| 246 | 246 | throw new Error('bye'); | |
| 247 | 247 | }); | |
| 248 | 248 | ||
| 249 | - describe('run after when before throws', () => { | ||
| 249 | + describe('run after when before throws', common.mustCall(() => { | ||
| 250 | 250 | after(common.mustCall(() => { | |
| 251 | 251 | console.log('- after() called'); | |
| 252 | 252 | })); | |
| 253 | 253 | before(() => { throw new Error('before'); }); | |
| 254 | 254 | it('1', () => {}); | |
| 255 | - }); | ||
| 255 | + })); | ||
| 256 | 256 | ||
| 257 | 257 | ||
| 258 | 258 | test('test hooks - async', async (t) => { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,7 +32,7 @@ test('top level test enabled', common.mustCall(async (t) => { | |||
| 32 | 32 | ); | |
| 33 | 33 | })); | |
| 34 | 34 | ||
| 35 | - describe('top level describe enabled', () => { | ||
| 35 | + describe('top level describe enabled', common.mustCall(() => { | ||
| 36 | 36 | before(common.mustCall()); | |
| 37 | 37 | beforeEach(common.mustCall(3)); | |
| 38 | 38 | afterEach(common.mustCall(3)); | |
@@ -44,7 +44,7 @@ describe('top level describe enabled', () => { | |||
| 44 | 44 | describe('nested describe enabled', common.mustCall(() => { | |
| 45 | 45 | it('is enabled', common.mustCall()); | |
| 46 | 46 | })); | |
| 47 | - }); | ||
| 47 | + })); | ||
| 48 | 48 | ||
| 49 | 49 | describe('yes', function() { | |
| 50 | 50 | it('no', () => {}); | |
@@ -76,13 +76,13 @@ describe('no with todo', { todo: true }, () => { | |||
| 76 | 76 | }); | |
| 77 | 77 | }); | |
| 78 | 78 | ||
| 79 | - describe('DescribeForMatchWithAncestors', () => { | ||
| 79 | + describe('DescribeForMatchWithAncestors', common.mustCall(() => { | ||
| 80 | 80 | it('NestedTest', () => common.mustNotCall()); | |
| 81 | 81 | ||
| 82 | - describe('NestedDescribeForMatchWithAncestors', () => { | ||
| 82 | + describe('NestedDescribeForMatchWithAncestors', common.mustCall(() => { | ||
| 83 | 83 | it('NestedTest', common.mustCall()); | |
| 84 | - }); | ||
| 85 | - }); | ||
| 84 | + })); | ||
| 85 | + })); | ||
| 86 | 86 | ||
| 87 | 87 | describe('DescribeForMatchWithAncestors', () => { | |
| 88 | 88 | it('NestedTest', () => common.mustNotCall()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,14 +3,14 @@ const common = require('../../common'); | |||
| 3 | 3 | const assert = require('assert'); | |
| 4 | 4 | const addon = require(`./build/${common.buildType}/3_callbacks`); | |
| 5 | 5 | ||
| 6 | - addon.RunCallback(function(msg) { | ||
| 6 | + addon.RunCallback(common.mustCall((msg) => { | ||
| 7 | 7 | assert.strictEqual(msg, 'hello world'); | |
| 8 | - }); | ||
| 8 | + })); | ||
| 9 | 9 | ||
| 10 | 10 | function testRecv(desiredRecv) { | |
| 11 | - addon.RunCallbackWithRecv(function() { | ||
| 11 | + addon.RunCallbackWithRecv(common.mustCall(function() { | ||
| 12 | 12 | assert.strictEqual(this, desiredRecv); | |
| 13 | - }, desiredRecv); | ||
| 13 | + }), desiredRecv); | ||
| 14 | 14 | } | |
| 15 | 15 | ||
| 16 | 16 | testRecv(undefined); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -50,9 +50,9 @@ test_promise.concludeCurrentPromise(undefined, true); | |||
| 50 | 50 | const rejectPromise = Promise.reject(-1); | |
| 51 | 51 | const expected_reason = -1; | |
| 52 | 52 | assert.strictEqual(test_promise.isPromise(rejectPromise), true); | |
| 53 | - rejectPromise.catch((reason) => { | ||
| 53 | + rejectPromise.catch(common.mustCall((reason) => { | ||
| 54 | 54 | assert.strictEqual(reason, expected_reason); | |
| 55 | - }); | ||
| 55 | + })); | ||
| 56 | 56 | ||
| 57 | 57 | assert.strictEqual(test_promise.isPromise(2.4), false); | |
| 58 | 58 | assert.strictEqual(test_promise.isPromise('I promise!'), false); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,25 +21,25 @@ if (cluster.isPrimary) { | |||
| 21 | 21 | if (err.code === 'ENOTSUP') throw err; | |
| 22 | 22 | }); | |
| 23 | 23 | ||
| 24 | - worker1.on('message', (msg) => { | ||
| 24 | + worker1.on('message', common.mustCall((msg) => { | ||
| 25 | 25 | if (typeof msg !== 'object') process.exit(0); | |
| 26 | 26 | if (msg.message !== 'success') process.exit(0); | |
| 27 | 27 | if (typeof msg.port1 !== 'number') process.exit(0); | |
| 28 | 28 | ||
| 29 | 29 | const worker2 = cluster.fork({ PRT1: msg.port1 }); | |
| 30 | 30 | worker2.on('message', () => process.exit(0)); | |
| 31 | - worker2.on('exit', (code, signal) => { | ||
| 31 | + worker2.on('exit', common.mustCall((code, signal) => { | ||
| 32 | 32 | // This is the droid we are looking for | |
| 33 | 33 | assert.strictEqual(code, 0); | |
| 34 | 34 | assert.strictEqual(signal, null); | |
| 35 | - }); | ||
| 35 | + })); | ||
| 36 | 36 | ||
| 37 | 37 | // cleanup anyway | |
| 38 | 38 | process.on('exit', () => { | |
| 39 | 39 | worker1.send(BYE); | |
| 40 | 40 | worker2.send(BYE); | |
| 41 | 41 | }); | |
| 42 | - }); | ||
| 42 | + })); | ||
| 43 | 43 | // end primary code | |
| 44 | 44 | } else { | |
| 45 | 45 | // worker code | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,7 @@ if (!common.isLinux) { | |||
| 9 | 9 | common.skip('This test is only applicable to Linux'); | |
| 10 | 10 | } | |
| 11 | 11 | ||
| 12 | - const { ok, strictEqual } = require('assert'); | ||
| 12 | + const assert = require('assert'); | ||
| 13 | 13 | const { join } = require('path'); | |
| 14 | 14 | const path = require('path'); | |
| 15 | 15 | const tmpdir = require('../common/tmpdir'); | |
@@ -42,8 +42,8 @@ const name = Buffer.from([ | |||
| 42 | 42 | const testPath = Buffer.concat([tmpdirPath, sepBuf, name]); | |
| 43 | 43 | ||
| 44 | 44 | writeFileSync(testPath, 'test content'); | |
| 45 | - ok(existsSync(testPath)); | ||
| 46 | - strictEqual(readFileSync(testPath, 'utf8'), 'test content'); | ||
| 45 | + assert.ok(existsSync(testPath)); | ||
| 46 | + assert.strictEqual(readFileSync(testPath, 'utf8'), 'test content'); | ||
| 47 | 47 | ||
| 48 | 48 | // The cpSync is expected to fail because the implementation does not | |
| 49 | 49 | // properly handle non-UTF8 names in the path. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments