Skip to content

Commit

Permalink
ci: do not try to access mic in ci tests
Browse files Browse the repository at this point in the history
  • Loading branch information
b-ma committed Dec 24, 2024
1 parent 8309c7e commit 8136cec
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/verify-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ jobs:
- name: Lint
run: npm run lint
- name: Test
run: npm run test
run: npm run test:ci

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"preversion": "yarn install && npm run generate",
"postversion": "cargo bump $npm_package_version && git commit -am \"v$npm_package_version\" && node .scripts/check-changelog.mjs",
"test": "mocha tests/*.spec.mjs",
"test:ci": "mocha tests/*.spec.mjs -- --ci",
"test:only": "mocha",
"wpt": "npm run build && node ./.scripts/wpt-harness.mjs",
"wpt:only": "node ./.scripts/wpt-harness.mjs"
Expand Down
20 changes: 20 additions & 0 deletions tests/getUserMedia.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { sleep } from '@ircam/sc-utils';

import { mediaDevices, AudioContext, MediaStreamAudioSourceNode } from '../index.mjs';

const CI = process.argv.includes('--ci');

describe('# mediaDevices.getUserMedia(options)', () => {
it('should fail if no argument given', async () => {
let failed = false;
Expand Down Expand Up @@ -48,6 +50,12 @@ describe('# mediaDevices.getUserMedia(options)', () => {
});

it('should not fail if options.audio = true', async () => {
// accessing microphone in CI make the process stuck
if (CI) {
console.log('Run in CI, aborting...');
return;
}

let failed = false;
const audioContext = new AudioContext();

Expand All @@ -67,6 +75,12 @@ describe('# mediaDevices.getUserMedia(options)', () => {
});

it('should work with MediaStreamAudioSourceNode [1 factory] (make some noise)', async () => {
// accessing microphone in CI make the process stuck
if (CI) {
console.log('Run in CI, aborting...');
return;
}

let failed = false;
const audioContext = new AudioContext();

Expand All @@ -89,6 +103,12 @@ describe('# mediaDevices.getUserMedia(options)', () => {
});

it('should work with MediaStreamAudioSourceNode [2 ctor] (make some noise)', async () => {
// accessing microphone in CI make the process stuck
if (CI) {
console.log('Run in CI, aborting...');
return;
}

let failed = false;
const audioContext = new AudioContext();

Expand Down

0 comments on commit 8136cec

Please sign in to comment.