Skip to content

Commit

Permalink
Merge pull request #1562 from rvilarl/update/qunit
Browse files Browse the repository at this point in the history
Upgrade QUnit and node packages.
  • Loading branch information
rvilarl authored May 2, 2023
2 parents 54036f5 + dc65350 commit ab68359
Show file tree
Hide file tree
Showing 37 changed files with 755 additions and 5,371 deletions.
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ module.exports = (grunt) => {
files: ['tests/flow-headless-browser.html'],
options: {
puppeteer: {
headless: "new",
args: ['--no-sandbox', '--disable-setuid-sandbox'],
},
},
Expand Down
1,519 changes: 653 additions & 866 deletions package-lock.json

Large diffs are not rendered by default.

31 changes: 16 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,14 @@
"url": "https://github.com/0xfe/vexflow/issues"
},
"devDependencies": {
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/parser": "^5.57.0",
"@types/qunit": "^2.19.5",
"@types/node": "^18.16.3",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",
"canvas": "^2.11.2",
"circular-dependency-plugin": "^5.2.2",
"concurrently": "^8.0.1",
"eslint": "^8.37.0",
"eslint": "^8.39.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
Expand All @@ -101,28 +102,28 @@
"grunt-cli": "^1.4.3",
"grunt-contrib-clean": "^2.0.1",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-qunit": "^5.1.1",
"grunt-contrib-qunit": "^7.0.0",
"grunt-eslint": "^24.0.1",
"grunt-webpack": "^5.0.0",
"jsdom": "^21.1.1",
"jsdom": "^21.1.2",
"jspdf": "^2.5.1",
"npm": "^9.6.3",
"npm": "^9.6.5",
"opener": "^1.5.2",
"opentype.js": "^1.3.4",
"prettier": "^2.8.7",
"puppeteer": "^19.8.2",
"prettier": "^2.8.8",
"puppeteer": "^19.11.1",
"qunit": "^2.19.4",
"recursive-copy": "^2.0.14",
"release-it": "^15.10.0",
"sharp": "^0.32.0",
"release-it": "^15.10.2",
"sharp": "^0.32.1",
"string-replace-loader": "^3.1.0",
"svg2pdf.js": "^2.2.1",
"terser-webpack-plugin": "^5.3.7",
"ts-loader": "^9.4.2",
"tsc-watch": "^6.0.0",
"typedoc": "^0.23.28",
"typescript": "^5.0.3",
"webpack": "^5.77.0"
"tsc-watch": "^6.0.4",
"typedoc": "^0.24.6",
"typescript": "^5.0.4",
"webpack": "^5.81.0"
},
"scripts": {
"start": "grunt",
Expand Down
2 changes: 1 addition & 1 deletion tests/accidental_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function makeNewAccid(factory: Factory) {
/**
*
*/
function autoAccidentalWorking(assert: any): void {
function autoAccidentalWorking(assert: Assert): void {
const createStaveNote = (noteStruct: StaveNoteStruct) => new StaveNote(noteStruct);

let notes = [
Expand Down
2 changes: 1 addition & 1 deletion tests/barline_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const BarlineTests = {
},
};

function enums(assert: any): void {
function enums(assert: Assert): void {
// VexFlow 4.0 renamed Barline.type => BarlineType.
// The old way still works, for backwards compatibility.
assert.equal(Barline.type, BarlineType);
Expand Down
4 changes: 2 additions & 2 deletions tests/boundingbox_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const BoundingBoxTests = {
},
};

function initialization(assert: any): void {
function initialization(assert: Assert): void {
const bb = new BoundingBox(4, 5, 6, 7);
assert.equal(bb.getX(), 4, 'Bad X');
assert.equal(bb.getY(), 5, 'Bad Y');
Expand All @@ -26,7 +26,7 @@ function initialization(assert: any): void {
assert.equal(bb.getX(), 5, 'Bad X');
}

function merging(assert: any): void {
function merging(assert: Assert): void {
const tests = [
{
type: 'Intersection',
Expand Down
2 changes: 1 addition & 1 deletion tests/boundingboxcomputation_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const BoundingBoxComputationTests = {
},
};

function point(assert: any): void {
function point(assert: Assert): void {
const bboxComp = new BoundingBoxComputation();
bboxComp.addPoint(2, 3);
assert.equal(bboxComp.getX1(), 2, 'Bad X1');
Expand Down
14 changes: 7 additions & 7 deletions tests/easyscore_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function createShortcuts(score: EasyScore) {
* - all strings in `mustPass` parse correctly
* - all strings in `mustFail` fail to parse (i.e., Result.success is `false`).
*/
function basic(assert: any): void {
function basic(assert: Assert): void {
const score = new EasyScore();
const mustPass = ['c4', 'c#4', 'c4/r', 'c#5', 'c3/m', 'c3//m', 'c3//h', 'c3/s', 'c3//s', 'c3/g', 'c3//g'];
const mustFail = ['', '()', '7', '(c#4 e5 g6'];
Expand All @@ -70,7 +70,7 @@ function basic(assert: any): void {
mustFail.forEach((line) => assert.equal(score.parse(line).success, false, line));
}

function accidentals(assert: any): void {
function accidentals(assert: Assert): void {
const score = new EasyScore();
const mustPass = [
'c3',
Expand Down Expand Up @@ -126,7 +126,7 @@ function accidentals(assert: any): void {
mustFail.forEach((line) => assert.equal(score.parse(line).success, false, line));
}

function durations(assert: any): void {
function durations(assert: Assert): void {
const score = new EasyScore();
const mustPass = ['c3/4', 'c##3/w, cb3', 'c##3/w, cb3/q', 'c##3/q, cb3/32', '(c##3 cbb3 cn3), cb3'];
const mustFail = ['Cn3/]', '/', '(cq cbb3 cn3), cb3', '(cdd7 cbb3 cn3), cb3'];
Expand All @@ -135,7 +135,7 @@ function durations(assert: any): void {
mustFail.forEach((line) => assert.equal(score.parse(line).success, false, line));
}

function chords(assert: any): void {
function chords(assert: Assert): void {
const score = new EasyScore();
const mustPass = [
'(c5)',
Expand All @@ -151,7 +151,7 @@ function chords(assert: any): void {
mustFail.forEach((line) => assert.equal(score.parse(line).success, false, line));
}

function dots(assert: any): void {
function dots(assert: Assert): void {
const score = new EasyScore();
const mustPass = [
'c3/4.',
Expand All @@ -168,7 +168,7 @@ function dots(assert: any): void {
mustFail.forEach((line) => assert.equal(score.parse(line).success, false, line));
}

function types(assert: any): void {
function types(assert: Assert): void {
const score = new EasyScore();
const mustPass = ['c3/4/m.', 'c##3//r.., cb3', 'c##3/m.., cb3', 'c##3/r.., cb3', 'd##3/w/s, cb3/q...', 'Fb4'];
const mustFail = ['c4/q/U', '(c##4, cbb4 cn4)/w.., (c#5 cb2 a3)/32', 'z#3'];
Expand All @@ -177,7 +177,7 @@ function types(assert: any): void {
mustFail.forEach((line) => assert.equal(score.parse(line).success, false, line));
}

function options(assert: any): void {
function options(assert: Assert): void {
const score = new EasyScore();
const mustPass = [
'c3/4.[foo="bar"]',
Expand Down
2 changes: 1 addition & 1 deletion tests/factory_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const FactoryTests = {
},
};

function defaults(assert: any): void {
function defaults(assert: Assert): void {
// Throws RuntimeError: 'HTML DOM element not set in Factory'
assert.throws(
() => new Factory({ renderer: { elementId: '', width: 700, height: 500 } }),
Expand Down
3 changes: 2 additions & 1 deletion tests/flow-headless-browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
</head>
<body>
<div id="vexflow_testoutput"></div>
<script src="support/qunit.js"></script>
<script src="../node_modules/qunit/qunit/qunit.js"></script>
<script src="../build/cjs/vexflow-debug-with-tests.js"></script>
<script>
QUnit.config.noglobals = true;
QUnit.start();
Vex.Flow.Test.run();
</script>
</body>
Expand Down
6 changes: 3 additions & 3 deletions tests/flow.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<head>
<title>VexFlow - JavaScript Music Notation and Guitar Tab</title>
<link rel="stylesheet" href="flow.css" type="text/css" media="screen" />
<link rel="stylesheet" href="support/qunit.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css" type="text/css" media="screen" />
<meta charset="UTF-8" />
</head>
<body>
Expand Down Expand Up @@ -149,7 +149,7 @@ <h3>

// Load qunit.js as late as possible to avoid a race condition!
// The QUnit module drop down box doesn't appear if Vex.Flow.Test.runTests() runs too late.
await loadScript('support/qunit.js');
await loadScript('../node_modules/qunit/qunit/qunit.js');

// Optionally specify the QUnit module or filter in the fragment identifier.
if (hashParams) {
Expand All @@ -164,7 +164,7 @@ <h3>
// Show only failed tests.
QUnit.config.hidepassed = true;
QUnit.config.noglobals = true;

QUnit.start();
VF.Test.run();
</script>
</body>
Expand Down
6 changes: 3 additions & 3 deletions tests/font_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const FontTests = {
/**
* Test out the setFont method in various classes.
*/
function setFont(assert: any): void {
function setFont(assert: Assert): void {
// Create a CanvasCntext and call setFont on it.
const canvas = document.createElement('canvas');
canvas.width = 800;
Expand Down Expand Up @@ -71,7 +71,7 @@ function setFont(assert: any): void {
assert.equal(flat.getFont(), '10pt Arial, sans-serif');
}

function fontParsing(assert: any): void {
function fontParsing(assert: Assert): void {
const b = new Bend('1/2', true);
const bFont = b.fontInfo;
// Check the default font.
Expand All @@ -97,7 +97,7 @@ function fontParsing(assert: any): void {
assert.equal(f3SizeInPx, 24);
}

function fontSizes(assert: any): void {
function fontSizes(assert: Assert): void {
{
const size = '17px';
const sizeInEm = Font.convertSizeToPixelValue(size) / Font.scaleToPxFrom.em;
Expand Down
2 changes: 1 addition & 1 deletion tests/formatter_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function getGlyphWidth(glyphName: string): number {
return widthInEm * 38 * Font.scaleToPxFrom.pt;
}

function buildTickContexts(assert: any): void {
function buildTickContexts(assert: Assert): void {
function createTickable(beat: number) {
return new MockTickable().setTicks(beat);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/fraction_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const FractionTests = {
},
};

function basic(assert: any): void {
function basic(assert: Assert): void {
const f_1_2 = new Fraction(1, 2);
assert.ok(f_1_2.equals(0.5), 'Fraction: 1/2 equals 0.5');
assert.ok(f_1_2.equals(new Fraction(1, 2)), 'Fraction: 1/2 equals 1/2');
Expand Down Expand Up @@ -72,7 +72,7 @@ function basic(assert: any): void {
assert.equal(Fraction.GCD(15, 10), 5);
}

function withOtherFractions(assert: any): void {
function withOtherFractions(assert: Assert): void {
const f_1_2 = new Fraction(1, 2);
const f_1_4 = new Fraction(1, 4);
const f_1_8 = new Fraction(1, 8);
Expand Down
1 change: 0 additions & 1 deletion tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export * from './barline_tests';
export * from './beam_tests';
export * from './bend_tests';
export * from './boundingbox_tests';
export * from './boundingboxcomputation_tests';
export * from './chordsymbol_tests';
export * from './clef_tests';
export * from './crossbeam_tests';
Expand Down
4 changes: 2 additions & 2 deletions tests/keymanager_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const KeyManagerTests = {
},
};

function works(assert: any): void {
function works(assert: Assert): void {
const manager = new KeyManager('g');
assert.equal(manager.getAccidental('f').accidental, '#');

Expand All @@ -33,7 +33,7 @@ function works(assert: any): void {
assert.equal(manager.getAccidental('f').accidental, '#');
}

function selectNotes(assert: any): void {
function selectNotes(assert: Assert): void {
const manager = new KeyManager('f');
assert.equal(manager.selectNote('bb').note, 'bb');
assert.equal(manager.selectNote('bb').accidental, 'b');
Expand Down
2 changes: 1 addition & 1 deletion tests/keysignature_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const fontWidths = () => {
return { sharpWidth, flatWidth, naturalWidth, clefWidth };
};

function parser(assert: any): void {
function parser(assert: Assert): void {
assert.expect(11);

function catchError(spec: string): void {
Expand Down
4 changes: 2 additions & 2 deletions tests/modifier_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ const ModifierContextTests = {
},
};

function width(assert: any): void {
function width(assert: Assert): void {
const mc = new ModifierContext();
assert.equal(mc.getWidth(), 0, 'New modifier context has no width');
}

function management(assert: any): void {
function management(assert: Assert): void {
const mc = new ModifierContext();
const modifier1 = new Modifier();
const modifier2 = new Modifier();
Expand Down
Loading

0 comments on commit ab68359

Please sign in to comment.