Skip to content

Commit

Permalink
Add fuzzing tests (slab#3789)
Browse files Browse the repository at this point in the history
  • Loading branch information
luin committed Aug 7, 2023
1 parent 5a3f038 commit 5ab6c0e
Show file tree
Hide file tree
Showing 13 changed files with 1,173 additions and 53 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/_fuzz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Unit Tests
on:
workflow_call:
jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: npm

- run: npm ci
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
- run: npm run test:fuzz
3 changes: 1 addition & 2 deletions .github/workflows/_unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
- run: npm run lint
- run: npm run test:unit:ci
- run: npm run test:unit
env:
BROWSER: ${{ matrix.browser }}
- run: npm run test:random
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ concurrency:
jobs:
unit:
uses: ./.github/workflows/_unit.yml
fuzz:
uses: ./.github/workflows/_fuzz.yml
e2e:
uses: ./.github/workflows/_e2e.yml
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ formats/*.js
modules/*.js
themes/*.js
ui/*.js
test/random.js

test/**/*.js
!test/helpers/**/*.js
!test/unit/**/*.js
!test/unit.js

core.js
quill.js
Expand Down
13 changes: 13 additions & 0 deletions _develop/karma.fuzz.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const dns = require('node:dns');
dns.setDefaultResultOrder('ipv4first');

module.exports = config => {
config.set({
basePath: '../',
urlRoot: '/karma/',
files: [{ pattern: 'dist/fuzz.js', nocache: true }],
frameworks: ['jasmine'],
reporters: ['progress'],
browsers: ['jsdom'],
});
};
1 change: 1 addition & 0 deletions _develop/karma.config.js → _develop/karma.unit.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ module.exports = config => {

/* eslint-disable no-param-reassign */
if (process.env.GITHUB_ACTION) {
config.reporters = ['dots', 'saucelabs'];
config.transports = ['polling'];
config.browsers = [process.env.BROWSER];
config.browserDisconnectTimeout = 10000;
Expand Down
1 change: 1 addition & 0 deletions _develop/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const baseConfig = {
'quill.bubble': './assets/bubble.styl',
'quill.snow': './assets/snow.styl',
'unit.js': './test/unit.js',
'fuzz.js': './test/fuzz.ts',
},
output: {
filename: '[name]',
Expand Down
Loading

0 comments on commit 5ab6c0e

Please sign in to comment.