File tree Expand file tree Collapse file tree 5 files changed +61
-0
lines changed
Expand file tree Collapse file tree 5 files changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -485,6 +485,7 @@ <h1>index.coffee</h1>
485485module.< span class ="hljs-built_in "> exports</ span > .< span class ="hljs-built_in "> eval</ span > = CoffeeScript.< span class ="hljs-built_in "> eval</ span >
486486module.< span class ="hljs-built_in "> exports</ span > .run = CoffeeScript.run
487487module.< span class ="hljs-built_in "> exports</ span > .transpile = CoffeeScript.transpile
488+ module.< span class ="hljs-built_in "> exports</ span > .patchStackTrace = CoffeeScript.patchStackTrace
488489module.< span class ="hljs-built_in "> exports</ span > ._compileRawFileContent = CoffeeScript._compileRawFileContent
489490module.< span class ="hljs-built_in "> exports</ span > ._compileFile = CoffeeScript._compileFile</ pre > </ div > </ div >
490491
Original file line number Diff line number Diff line change @@ -31451,6 +31451,36 @@ <h2>Another heading</h2>
3145131451 ].join('\n')
3145231452 ok new OptionParser(flags).help() is expected
3145331453
31454+ </script>
31455+ <script type="text/x-coffeescript" class="test" id="package">
31456+ return if window? or testingBrowser?
31457+
31458+ {EventEmitter} = require 'events'
31459+ {join} = require 'path'
31460+ {cwd} = require 'process'
31461+ {pathToFileURL} = require 'url'
31462+
31463+
31464+ packageEntryPath = join cwd(), 'lib/coffeescript/index.js'
31465+ packageEntryUrl = pathToFileURL packageEntryPath
31466+
31467+
31468+ test "the coffeescript package exposes all members as named exports in Node", ->
31469+
31470+ requiredPackage = require packageEntryPath
31471+ requiredKeys = Object.keys requiredPackage
31472+
31473+ importedPackage = await import(packageEntryUrl)
31474+ importedKeys = new Set Object.keys(importedPackage)
31475+
31476+ # In `command.coffee`, CoffeeScript extends a `new EventEmitter`;
31477+ # we want to ignore these additional added keys.
31478+ eventEmitterKeys = new Set Object.getOwnPropertyNames(Object.getPrototypeOf(new EventEmitter))
31479+
31480+ for key in requiredKeys when not eventEmitterKeys.has(key)
31481+ # Use `eq` test so that missing keys have their names printed in the error message.
31482+ eq (if importedKeys.has(key) then key else undefined), key
31483+
3145431484</script>
3145531485<script type="text/x-coffeescript" class="test" id="parser">
3145631486# Parser
Original file line number Diff line number Diff line change @@ -155,5 +155,6 @@ module.exports.register = CoffeeScript.register
155155module .exports .eval = CoffeeScript .eval
156156module .exports .run = CoffeeScript .run
157157module .exports .transpile = CoffeeScript .transpile
158+ module .exports .patchStackTrace = CoffeeScript .patchStackTrace
158159module .exports ._compileRawFileContent = CoffeeScript ._compileRawFileContent
159160module .exports ._compileFile = CoffeeScript ._compileFile
Original file line number Diff line number Diff line change 1+ return if window ? or testingBrowser?
2+
3+ {EventEmitter } = require ' events'
4+ {join } = require ' path'
5+ {cwd } = require ' process'
6+ {pathToFileURL } = require ' url'
7+
8+
9+ packageEntryPath = join cwd (), ' lib/coffeescript/index.js'
10+ packageEntryUrl = pathToFileURL packageEntryPath
11+
12+
13+ test " the coffeescript package exposes all members as named exports in Node" , ->
14+
15+ requiredPackage = require packageEntryPath
16+ requiredKeys = Object .keys requiredPackage
17+
18+ importedPackage = await import (packageEntryUrl)
19+ importedKeys = new Set Object .keys (importedPackage)
20+
21+ # In `command.coffee`, CoffeeScript extends a `new EventEmitter`;
22+ # we want to ignore these additional added keys.
23+ eventEmitterKeys = new Set Object .getOwnPropertyNames (Object .getPrototypeOf (new EventEmitter ))
24+
25+ for key in requiredKeys when not eventEmitterKeys .has (key)
26+ # Use `eq` test so that missing keys have their names printed in the error message.
27+ eq (if importedKeys .has (key) then key else undefined ), key
You can’t perform that action at this time.
0 commit comments