Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
4c807f78
Commit
4c807f78
authored
Sep 24, 2020
by
Jerome Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Setup basic jest environment
parent
ed509d24
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
1 deletion
+38
-1
package.json
wasm/package.json
+1
-1
bootstrap.test.js
wasm/tests/bootstrap.test.js
+16
-0
utils.js
wasm/tests/utils.js
+21
-0
No files found.
wasm/package.json
View file @
4c807f78
...
...
@@ -4,7 +4,7 @@
"description"
:
"ffmpeg.wasm core"
,
"main"
:
"dist/ffmpeg-core.js"
,
"scripts"
:
{
"test"
:
"jest"
"test"
:
"
node --experimental-wasm-threads --experimental-wasm-bulk-memory ./node_modules/.bin/
jest"
},
"repository"
:
{
"type"
:
"git"
,
...
...
wasm/tests/bootstrap.test.js
0 → 100644
View file @
4c807f78
const
{
initModule
,
parseArgs
,
}
=
require
(
'./utils'
);
let
Module
=
null
;
let
ffmpeg
=
null
;
beforeAll
(
async
()
=>
{
Module
=
await
initModule
();
ffmpeg
=
Module
.
cwrap
(
'proxy_main'
,
'number'
,
[
'number'
,
'number'
]);
});
test
(
'test'
,
()
=>
{
const
ret
=
ffmpeg
(...
parseArgs
([
'ffmpeg'
,
'-v'
]));
expect
(
ret
).
toBe
(
0
);
});
wasm/tests/utils.js
0 → 100644
View file @
4c807f78
let
Module
=
null
;
exports
.
initModule
=
()
=>
(
new
Promise
((
resolve
)
=>
{
const
_Module
=
require
(
'../dist/ffmpeg-core.js'
);
_Module
.
onRuntimeInitialized
=
()
=>
{
Module
=
_Module
;
resolve
(
Module
);
}
})
);
exports
.
parseArgs
=
(
args
)
=>
{
const
argsPtr
=
Module
.
_malloc
(
args
.
length
*
Uint32Array
.
BYTES_PER_ELEMENT
);
args
.
forEach
((
s
,
idx
)
=>
{
const
buf
=
Module
.
_malloc
(
s
.
length
+
1
);
Module
.
writeAsciiToMemory
(
s
,
buf
);
Module
.
setValue
(
argsPtr
+
(
Uint32Array
.
BYTES_PER_ELEMENT
*
idx
),
buf
,
'i32'
);
});
return
[
args
.
length
,
argsPtr
];
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment