Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22405038
compiling.test.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
compiling.test.ts
View Options
import
{
compile
,
tempstream_esbuild
}
from
"src/tempstream_esbuild.js"
;
import
fs
from
"node:fs"
;
describe
(
"Example"
,
()
=>
{
describe
(
"example"
,
()
=>
{
it
(
"simple assignment, skipping whitespace"
,
async
()
=>
{
let
output
=
compile
(
`var a =
<hello></hello>`
,
"example.tsx"
);
let
supposed
=
`import {tempstream as tmpstream_opt, JSX as tmpjsx} from 'tempstream'
var a =
tmpstream_opt\`<hello></hello>\``
;
if
(
!
output
.
startsWith
(
supposed
))
throw
Error
(
"Eq failed"
);
});
it
(
"simple assignment, skipping more whitespace"
,
async
()
=>
{
let
output
=
compile
(
`var a =
<hello></hello>`
,
"example.tsx"
);
let
supposed
=
`import {tempstream as tmpstream_opt, JSX as tmpjsx} from 'tempstream'
var a =
tmpstream_opt\`<hello></hello>\``
;
if
(
!
output
.
startsWith
(
supposed
))
throw
Error
(
"Eq failed"
);
});
it
(
"removing comments"
,
async
()
=>
{
let
output
=
compile
(
`var a =
<hello>{ /*
Hello world
*/
/*
* Foo bar baz
*/
}</hello>`
,
"example.tsx"
);
let
supposed
=
`import {tempstream as tmpstream_opt, JSX as tmpjsx} from 'tempstream'
var a =
tmpstream_opt\`<hello></hello>\``
;
if
(
!
output
.
startsWith
(
supposed
))
throw
Error
(
"Eq failed"
);
});
it
(
"removing fragments and comments"
,
async
()
=>
{
let
output
=
compile
(
`var a =
<><hello>{ /*
Hello world
*/
/*
* Foo bar baz
*/
}</hello></>`
,
"example.tsx"
);
let
supposed
=
`import {tempstream as tmpstream_opt, JSX as tmpjsx} from 'tempstream'
var a =
tmpstream_opt\`<hello></hello>\``
;
if
(
!
output
.
startsWith
(
supposed
))
throw
Error
(
"Eq failed"
);
});
it
(
"Everything together, all at once"
,
async
()
=>
{
let
output
=
compile
(
`var a =
<><hello>{ /*
Hello world
*/
/*
* Foo bar baz
*/
}
{() => {
let a = <><div></div></>
let b = <div> {a} </div>
}()
}
</hello></>`
,
"example.tsx"
);
let
supposed
=
`import {tempstream as tmpstream_opt, JSX as tmpjsx} from 'tempstream'
var a =
tmpstream_opt\`<hello>
\${() => {
let a = tmpstream_opt\`<div></div>\`
let b = tmpstream_opt\`<div> \${a} </div>\`
}()
}
</hello>\``
;
if
(
!
output
.
startsWith
(
supposed
))
throw
Error
(
"Eq failed"
);
});
});
});
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Fri, Nov 27, 19:25 (8 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1213565
Default Alt Text
compiling.test.ts (2 KB)
Attached To
Mode
rTEMPCOMP tempstream-esbuild
Attached
Detach File
Event Timeline