File tree Expand file tree Collapse file tree 5 files changed +120
-0
lines changed
Expand file tree Collapse file tree 5 files changed +120
-0
lines changed Original file line number Diff line number Diff line change 1+ import { test , expect } from '@playwright/test' ;
2+
3+ test ( 'test output matches' , async ( { page } ) => {
4+ const consolePromise = page . waitForEvent ( 'console' , {
5+ predicate : ( msg ) => msg . text ( ) . includes ( '> "New Transaction Body Created:"' )
6+ } ) ;
7+
8+ await page . goto ( 'http://localhost:8081' ) ;
9+
10+ await consolePromise ;
11+ } ) ;
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html >
3+ < head >
4+ < meta charset ="utf-8 " />
5+ < title > Getting Started</ title >
6+ </ head >
7+ < body >
8+ </ body >
9+ </ html >
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " wtest" ,
3+ "version" : " 1.0.0" ,
4+ "entry" : " ./src/index.js" ,
5+ "private" : true ,
6+ "scripts" : {
7+ "test" : " echo \" Error: no test specified\" && exit 1"
8+ },
9+ "keywords" : [],
10+ "author" : " " ,
11+ "license" : " ISC" ,
12+ "description" : " " ,
13+ "devDependencies" : {
14+ "webpack" : " ^5.102.0" ,
15+ "webpack-cli" : " ^6.0.1" ,
16+ "webpack-dev-server" : " ^5.2.2"
17+ },
18+ "dependencies" : {
19+ "copy-webpack-plugin" : " ^13.0.1" ,
20+ "html-webpack-plugin" : " ^5.6.4"
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ function log ( out ) {
2+ var output = "" ;
3+ if ( typeof ( out ) == "object" ) {
4+ output += "> [object] {\n" ;
5+ for ( let [ key , val ] of Object . entries ( out ) ) {
6+ let text = val . toString ( ) ;
7+ if ( typeof ( val ) == "function" ) {
8+ text = text . split ( "{" ) [ 0 ] ;
9+ }
10+ output += " " + key + ": " + text + "\n" ;
11+ }
12+ output += " }\n" ;
13+ } else if ( typeof ( out ) == "bigint" ) {
14+ output += "> " + out . toString ( ) + "n\n" ;
15+ } else {
16+ output += "> " + JSON . stringify ( out ) + "\n" ;
17+ }
18+ console . log ( output ) ;
19+ }
20+
21+ ( async ( ) => {
22+ const cardanoModule = await import ( 'cardano-wasm' ) ;
23+ const api = await cardanoModule . default ( ) ;
24+
25+ log ( "Cardano API initialised:" ) ;
26+ log ( cardanoModule ) ;
27+
28+
29+ log ( "Cardano API instance created:" ) ;
30+ log ( api ) ;
31+
32+ const tx = await api . tx . newTx ( ) ;
33+ log ( "New Transaction Body Created:" , tx ) ;
34+ } ) ( ) ;
Original file line number Diff line number Diff line change 1+ const HtmlWebpackPlugin = require ( 'html-webpack-plugin' ) ;
2+ const CopyWebpackPlugin = require ( 'copy-webpack-plugin' ) ;
3+ const path = require ( 'path' ) ;
4+
5+ module . exports = {
6+ entry : './src/index.js' ,
7+
8+ target : [ 'web' , 'es2020' ] ,
9+
10+ output : {
11+ filename : 'main.js' ,
12+ path : path . resolve ( __dirname , 'dist' ) ,
13+ publicPath : '' ,
14+ } ,
15+
16+ experiments : {
17+ asyncWebAssembly : true ,
18+ } ,
19+ devtool : 'source-map' ,
20+ plugins : [
21+ new HtmlWebpackPlugin ( { template : './index.html' } ) ,
22+ new CopyWebpackPlugin ( {
23+ patterns : [
24+ {
25+ from : 'node_modules/cardano-wasm/dist/cardano-wasm.js' ,
26+ to : 'cardano-wasm.js' ,
27+ } ,
28+ ] ,
29+ } ) ,
30+ ] ,
31+
32+
33+ module : {
34+ rules : [
35+ {
36+ test : / \. w a s m $ / ,
37+ type : 'asset/resource' ,
38+ } ,
39+ ] ,
40+ } ,
41+
42+ mode : 'development' ,
43+ } ;
44+
You can’t perform that action at this time.
0 commit comments