| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | 22 | 'use strict'; | |
| 23 | 23 | ||
| 24 | - require('../common'); | ||
| 24 | + require('../../common'); | ||
| 25 | 25 | ||
| 26 | 26 | const spawn = require('child_process').spawn; | |
| 27 | 27 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,76 @@ | |||
| 1 | + [eval] | ||
| 2 | + [eval]:1 | ||
| 3 | + with(this){__filename} | ||
| 4 | + ^^^^ | ||
| 5 | + | ||
| 6 | + SyntaxError: Strict mode code may not include a with statement | ||
| 7 | + | ||
| 8 | + | ||
| 9 | + | ||
| 10 | + | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + Node.js * | ||
| 15 | + 42 | ||
| 16 | + 42 | ||
| 17 | + [eval]:1 | ||
| 18 | + throw new Error("hello") | ||
| 19 | + ^ | ||
| 20 | + | ||
| 21 | + Error: hello | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + | ||
| 25 | + | ||
| 26 | + | ||
| 27 | + | ||
| 28 | + | ||
| 29 | + | ||
| 30 | + Node.js * | ||
| 31 | + [eval]:1 | ||
| 32 | + throw new Error("hello") | ||
| 33 | + ^ | ||
| 34 | + | ||
| 35 | + Error: hello | ||
| 36 | + | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + | ||
| 40 | + | ||
| 41 | + | ||
| 42 | + | ||
| 43 | + | ||
| 44 | + Node.js * | ||
| 45 | + 100 | ||
| 46 | + [eval]:1 | ||
| 47 | + var x = 100; y = x; | ||
| 48 | + ^ | ||
| 49 | + | ||
| 50 | + ReferenceError: y is not defined | ||
| 51 | + | ||
| 52 | + | ||
| 53 | + | ||
| 54 | + | ||
| 55 | + | ||
| 56 | + | ||
| 57 | + | ||
| 58 | + | ||
| 59 | + Node.js * | ||
| 60 | + | ||
| 61 | + [eval]:1 | ||
| 62 | + var ______________________________________________; throw 10 | ||
| 63 | + ^ | ||
| 64 | + 10 | ||
| 65 | + (Use `node --trace-uncaught ...` to show where the exception was thrown) | ||
| 66 | + | ||
| 67 | + Node.js * | ||
| 68 | + | ||
| 69 | + [eval]:1 | ||
| 70 | + var ______________________________________________; throw 10 | ||
| 71 | + ^ | ||
| 72 | + 10 | ||
| 73 | + (Use `node --trace-uncaught ...` to show where the exception was thrown) | ||
| 74 | + | ||
| 75 | + Node.js * | ||
| 76 | + done | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | 22 | 'use strict'; | |
| 23 | 23 | ||
| 24 | - require('../common'); | ||
| 24 | + require('../../common'); | ||
| 25 | 25 | ||
| 26 | 26 | const spawn = require('child_process').spawn; | |
| 27 | 27 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,89 @@ | |||
| 1 | + [stdin] | ||
| 2 | + [stdin]:1 | ||
| 3 | + with(this){__filename} | ||
| 4 | + ^^^^ | ||
| 5 | + | ||
| 6 | + SyntaxError: Strict mode code may not include a with statement | ||
| 7 | + | ||
| 8 | + | ||
| 9 | + | ||
| 10 | + | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + | ||
| 15 | + | ||
| 16 | + | ||
| 17 | + | ||
| 18 | + Node.js * | ||
| 19 | + 42 | ||
| 20 | + 42 | ||
| 21 | + [stdin]:1 | ||
| 22 | + throw new Error("hello") | ||
| 23 | + ^ | ||
| 24 | + | ||
| 25 | + Error: hello | ||
| 26 | + | ||
| 27 | + | ||
| 28 | + | ||
| 29 | + | ||
| 30 | + | ||
| 31 | + | ||
| 32 | + | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + | ||
| 37 | + Node.js * | ||
| 38 | + [stdin]:1 | ||
| 39 | + throw new Error("hello") | ||
| 40 | + ^ | ||
| 41 | + | ||
| 42 | + Error: hello | ||
| 43 | + | ||
| 44 | + | ||
| 45 | + | ||
| 46 | + | ||
| 47 | + | ||
| 48 | + | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + | ||
| 52 | + | ||
| 53 | + | ||
| 54 | + Node.js * | ||
| 55 | + 100 | ||
| 56 | + [stdin]:1 | ||
| 57 | + let x = 100; y = x; | ||
| 58 | + ^ | ||
| 59 | + | ||
| 60 | + ReferenceError: y is not defined | ||
| 61 | + | ||
| 62 | + | ||
| 63 | + | ||
| 64 | + | ||
| 65 | + | ||
| 66 | + | ||
| 67 | + | ||
| 68 | + | ||
| 69 | + | ||
| 70 | + | ||
| 71 | + | ||
| 72 | + Node.js * | ||
| 73 | + | ||
| 74 | + [stdin]:1 | ||
| 75 | + let ______________________________________________; throw 10 | ||
| 76 | + ^ | ||
| 77 | + 10 | ||
| 78 | + (Use `node --trace-uncaught ...` to show where the exception was thrown) | ||
| 79 | + | ||
| 80 | + Node.js * | ||
| 81 | + | ||
| 82 | + [stdin]:1 | ||
| 83 | + let ______________________________________________; throw 10 | ||
| 84 | + ^ | ||
| 85 | + 10 | ||
| 86 | + (Use `node --trace-uncaught ...` to show where the exception was thrown) | ||
| 87 | + | ||
| 88 | + Node.js * | ||
| 89 | + done | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,34 @@ | |||
| 1 | + import '../common/index.mjs'; | ||
| 2 | + import * as fixtures from '../common/fixtures.mjs'; | ||
| 3 | + import * as snapshot from '../common/assertSnapshot.js'; | ||
| 4 | + import { describe, it } from 'node:test'; | ||
| 5 | + | ||
| 6 | + describe('eval output', { concurrency: true }, () => { | ||
| 7 | + function normalize(str) { | ||
| 8 | + return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '') | ||
| 9 | + .replaceAll(/\d+:\d+/g, '*:*'); | ||
| 10 | + } | ||
| 11 | + | ||
| 12 | + const defaultTransform = snapshot.transform( | ||
| 13 | + removeStackTraces, | ||
| 14 | + normalize, | ||
| 15 | + snapshot.replaceWindowsLineEndings, | ||
| 16 | + snapshot.replaceWindowsPaths, | ||
| 17 | + snapshot.replaceNodeVersion | ||
| 18 | + ); | ||
| 19 | + | ||
| 20 | + function removeStackTraces(output) { | ||
| 21 | + return output.replaceAll(/^ *at .+$/gm, ''); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + const tests = [ | ||
| 25 | + { name: 'eval/eval_messages.js' }, | ||
| 26 | + { name: 'eval/stdin_messages.js' }, | ||
| 27 | + ]; | ||
| 28 | + | ||
| 29 | + for (const { name } of tests) { | ||
| 30 | + it(name, async () => { | ||
| 31 | + await snapshot.spawnAndAssert(fixtures.path(name), defaultTransform); | ||
| 32 | + }); | ||
| 33 | + } | ||
| 34 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments