Upload Kmake

This commit is contained in:
Gorochu
2026-05-26 23:36:42 -07:00
parent ba051b2f74
commit 555ec72358
41615 changed files with 13344630 additions and 1 deletions

View File

@ -0,0 +1,11 @@
const async_hooks = require('async_hooks');
const common = require('../../common');
const hook = async_hooks.createHook({
init: common.mustNotCall(),
before: common.mustNotCall(),
after: common.mustNotCall(),
destroy: common.mustNotCall()
});
hook.enable();

6
test/fixtures/v8-coverage/basic.js vendored Normal file
View File

@ -0,0 +1,6 @@
const a = 99;
if (true) {
const b = 101;
} else {
const c = 102;
}

View File

@ -0,0 +1,69 @@
'use strict';
function fnA() {
let cnt = 0;
try {
cnt++;
throw new Error('boom');
cnt++;
} catch (err) {
cnt++;
} finally {
if (false) {
}
return cnt;
}
cnt++;
}
function fnB(arr) {
for (let i = 0; i < arr.length; ++i) {
if (i === 2) {
continue;
} else {
fnE(1);
}
}
}
function fnC(arg1, arg2) {
if (arg1 === 1) {
if (arg2 === 3) {
return -1;
}
if (arg2 === 4) {
return 3;
}
if (arg2 === 5) {
return 9;
}
}
}
function fnD(arg) {
let cnt = 0;
if (arg % 2 === 0) {
cnt++;
} else if (arg === 1) {
cnt++;
} else if (arg === 3) {
cnt++;
} else {
fnC(1, 5);
}
return cnt;
}
function fnE(arg) {
const a = arg ?? 5;
return a;
}
module.exports = { fnA, fnB, fnC, fnD, fnE };

View File

@ -0,0 +1,12 @@
'use strict';
const { test } = require('node:test');
const common = require('./common');
function notCalled() {
}
test('first 1', () => {
common.fnA();
common.fnD(100);
common.fnB([1, 2, 3]);
});

View File

@ -0,0 +1,8 @@
'use strict';
const { test } = require('node:test');
const common = require('./common');
test('second 1', () => {
common.fnB([1, 2, 3]);
common.fnD(3);
});

View File

@ -0,0 +1,25 @@
'use strict';
const assert = require('node:assert');
const { unlinkSync, writeFileSync } = require('node:fs')
const { join } = require('node:path');
const { test } = require('node:test');
const common = require('./common');
test('third 1', () => {
common.fnC(1, 4);
common.fnD(99);
});
assert(process.env.NODE_TEST_TMPDIR);
const tmpFilePath = join(process.env.NODE_TEST_TMPDIR, 'temp-module.js');
writeFileSync(tmpFilePath, `
module.exports = {
fn() {
return 42;
}
};
`);
const tempModule = require(tmpFilePath);
assert.strictEqual(tempModule.fn(), 42);
// Deleted files should not be part of the coverage report.
unlinkSync(tmpFilePath);

7
test/fixtures/v8-coverage/exit-1.js vendored Normal file
View File

@ -0,0 +1,7 @@
const a = 99;
if (true) {
const b = 101;
} else {
const c = 102;
}
process.exit(1);

14
test/fixtures/v8-coverage/interval.js vendored Normal file
View File

@ -0,0 +1,14 @@
'use strict';
let counter = 0;
let result;
const TEST_INTERVALS = parseInt(process.env.TEST_INTERVALS) || 1;
const i = setInterval(function interval() {
counter++;
if (counter < TEST_INTERVALS) {
result = 1;
} else {
result = process.hrtime();
clearInterval(i);
}
}, 100);

7
test/fixtures/v8-coverage/sigint.js vendored Normal file
View File

@ -0,0 +1,7 @@
const a = 99;
if (true) {
const b = 101;
} else {
const c = 102;
}
process.kill(process.pid, "SIGINT");

View File

@ -0,0 +1,5 @@
const { spawnSync } = require('child_process');
const env = { ...process.env, NODE_V8_COVERAGE: '' };
spawnSync(process.execPath, [require.resolve('./subprocess')], {
env: env
});

View File

@ -0,0 +1,6 @@
const { spawnSync } = require('child_process');
const env = { ...process.env };
delete env.NODE_V8_COVERAGE
spawnSync(process.execPath, [require.resolve('./subprocess')], {
env: env
});

View File

@ -0,0 +1,3 @@
'use strict';
const v8 = require('v8');
v8.stopCoverage();

View File

@ -0,0 +1,8 @@
const a = 99;
setTimeout(() => {
if (false) {
const b = 101;
} else if (false) {
const c = 102;
}
}, 10);

View File

@ -0,0 +1,10 @@
'use strict';
const v8 = require('v8');
setTimeout(() => {
v8.takeCoverage();
}, 1000);
setTimeout(() => {
v8.takeCoverage();
}, 2000);

7
test/fixtures/v8-coverage/throw.js vendored Normal file
View File

@ -0,0 +1,7 @@
const a = 99;
if (true) {
const b = 101;
} else {
const c = 102;
}
throw new Error('test');

5
test/fixtures/v8-coverage/worker.js vendored Normal file
View File

@ -0,0 +1,5 @@
'use strict';
const { Worker } = require('worker_threads');
const path = require('path');
new Worker(path.resolve(__dirname, 'subprocess.js'));