| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,11 +26,14 @@ const env = { | |||
| 26 | 26 | console.log(child.stdout.toString()); | |
| 27 | 27 | const stderr = child.stderr.toString(); | |
| 28 | 28 | console.log(stderr); | |
| 29 | - // There should be one snapshot taken and then after the | ||
| 30 | - // snapshot heap limit callback is popped, the OOM callback | ||
| 31 | - // becomes effective. | ||
| 32 | - assert(stderr.includes('ERR_WORKER_OUT_OF_MEMORY')); | ||
| 33 | - const list = fs.readdirSync(tmpdir.path) | ||
| 34 | - .filter((file) => file.endsWith('.heapsnapshot')); | ||
| 35 | - assert.strictEqual(list.length, 1); | ||
| 29 | + const risky = /Not generating snapshots because it's too risky/.test(stderr); | ||
| 30 | + if (!risky) { | ||
| 31 | + // There should be one snapshot taken and then after the | ||
| 32 | + // snapshot heap limit callback is popped, the OOM callback | ||
| 33 | + // becomes effective. | ||
| 34 | + assert(stderr.includes('ERR_WORKER_OUT_OF_MEMORY')); | ||
| 35 | + const list = fs.readdirSync(tmpdir.path) | ||
| 36 | + .filter((file) => file.endsWith('.heapsnapshot')); | ||
| 37 | + assert.strictEqual(list.length, 1); | ||
| 38 | + } | ||
| 36 | 39 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,12 +58,17 @@ const env = { | |||
| 58 | 58 | env, | |
| 59 | 59 | }); | |
| 60 | 60 | console.log(child.stdout.toString()); | |
| 61 | - console.log(child.stderr.toString()); | ||
| 61 | + const stderr = child.stderr.toString(); | ||
| 62 | + console.log(stderr); | ||
| 62 | 63 | assert(common.nodeProcessAborted(child.status, child.signal), | |
| 63 | 64 | 'process should have aborted, but did not'); | |
| 64 | 65 | const list = fs.readdirSync(tmpdir.path) | |
| 65 | 66 | .filter((file) => file.endsWith('.heapsnapshot')); | |
| 66 | - assert.strictEqual(list.length, 1); | ||
| 67 | + const risky = [...stderr.matchAll( | ||
| 68 | + /Not generating snapshots because it's too risky/g)].length; | ||
| 69 | + assert(list.length + risky > 0 && list.length <= 3, | ||
| 70 | + `Generated ${list.length} snapshots ` + | ||
| 71 | + `and ${risky} was too risky`); | ||
| 67 | 72 | } | |
| 68 | 73 | ||
| 69 | 74 | { | |
@@ -79,10 +84,15 @@ const env = { | |||
| 79 | 84 | env, | |
| 80 | 85 | }); | |
| 81 | 86 | console.log(child.stdout.toString()); | |
| 82 | - console.log(child.stderr.toString()); | ||
| 87 | + const stderr = child.stderr.toString(); | ||
| 88 | + console.log(stderr); | ||
| 83 | 89 | assert(common.nodeProcessAborted(child.status, child.signal), | |
| 84 | 90 | 'process should have aborted, but did not'); | |
| 85 | 91 | const list = fs.readdirSync(tmpdir.path) | |
| 86 | 92 | .filter((file) => file.endsWith('.heapsnapshot')); | |
| 87 | - assert(list.length > 0 && list.length <= 3); | ||
| 93 | + const risky = [...stderr.matchAll( | ||
| 94 | + /Not generating snapshots because it's too risky/g)].length; | ||
| 95 | + assert(list.length + risky > 0 && list.length <= 3, | ||
| 96 | + `Generated ${list.length} snapshots ` + | ||
| 97 | + `and ${risky} was too risky`); | ||
| 88 | 98 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,10 +34,9 @@ if (!common.enoughTestMem) | |||
| 34 | 34 | 'process should have aborted, but did not'); | |
| 35 | 35 | const list = fs.readdirSync(tmpdir.path) | |
| 36 | 36 | .filter((file) => file.endsWith('.heapsnapshot')); | |
| 37 | - if (list.length === 0) { | ||
| 38 | - assert(stderr.includes( | ||
| 39 | - 'Not generating snapshots because it\'s too risky')); | ||
| 40 | - } else { | ||
| 41 | - assert(list.length > 0 && list.length <= 3); | ||
| 42 | - } | ||
| 37 | + const risky = [...stderr.matchAll( | ||
| 38 | + /Not generating snapshots because it's too risky/g)].length; | ||
| 39 | + assert(list.length + risky > 0 && list.length <= 3, | ||
| 40 | + `Generated ${list.length} snapshots ` + | ||
| 41 | + `and ${risky} was too risky`); | ||
| 43 | 42 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments